Link to home
Start Free TrialLog in
Avatar of Richard Korts
Richard KortsFlag for United States of America

asked on

What is php error?

This url:

https://www.lakoshvac.com/devdev/adj_markup.php?fr=smod&mfp=Y&mval=.95&selno=3098

This result:

Parse error: syntax error, unexpected end of file in /home/lakoshva/public_html/devdev/adj_markup.php on line 13

php source run through https://phpcodechecker.com/. No errors

Source attached.

What is the issue, I cannot see it?
adj_markup.php
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

At first glance, it all looks OK, but I would suggest you check the content of the included file (db_connect_nb.php) as that may contain errors. Including files can often throw out the line numbering.

FYI - You do have 2 header() calls on the same line, although that's unlikely to be the cause of your problem, but it should still be fixed:

header("Location: modify_price.php?fr=" . $fr . "&mfp=Y&ps=Y");header("Location: modify_price.php?fr=" . $fr . "&mfp=Y&ps=Y");
exit;

Open in new window

Avatar of Richard Korts

ASKER

Yeah, I did not notice the double header, that may be it. I will fix.

The include is just the database connection, it’s in every php program in the system.

Thanks,

Richard
ASKER CERTIFIED SOLUTION
Avatar of gr8gonzo
gr8gonzo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Gr8gonzo,

I understand that so called parsing errors are php syntax errors. The php syntax error checking site I indicated earlier is, in my experience about 99% correct.

So I think the odds of a parsing syntax error are about 1%.

I am not a Unix / Linux person, I will try to check as you suggest tomorrow. I can get my host to do that if need be.

Thanks
Sorry, I was unclear. I wasn't suggesting the site was wrong. I'm saying I think you might have the wrong script - maybe you were checking the wrong copy of the file. So I was recommending you run a lint check (and also rename) to check whether you were looking at the right or wrong file.
I asked the host to do php -l /home/lakoshva/public_html/devdev/adj_markup.php.

They responded with:


Check it now, it was missing a bunch of line breaks.

Line 12 had the lines for the rest of the files.

It now works!!

I am a little surprised with line breaks being an issue. I thought the ; in php defined the start of a new command, you could string them all together on one line.
Sounds like a questionable response from the host. Whitespace in PHP is generally ignored, so you can string together as many lines as like. The code you posted had all the line breaks in all the right places, so something else was going on!
That's what I thought, but the revised version (by the host) works, I have tried it.

Richard
I agree - line breaks shouldn't be a problem. Like Chris said, whitespace is typically ignored - the semicolon is the thing that matters. The "Line 12 had the lines for the rest of the files" sounds very odd - almost like there was some other unusual whitespace happening that wasn't really whitespace.