Closed Thread Icon

Preserved Topic: Debugging PHP Pages that link to <a href="https://ozoneasylum.com/backlink?for=20877" title="Pages that link to Preserved Topic: Debugging PHP" rel="nofollow" >Preserved Topic: Debugging PHP\

 
Author Thread
jiblet
Paranoid (IV) Inmate

From: Minneapolis, MN, USA
Insane since: May 2000

posted posted 04-10-2001 21:17

Every time I have an error in a PHP script, the page returns a parsing error at line 1 regardless of where the error actually is? Is there some way to configure PHP to return the actual line #?

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 04-10-2001 21:22

Must say it's always given me the right number I don't think there's any config issue there.

Are you using your semi-colons?
The only time I get something like this is if I forget a semi-colon


Walking the Earth like Kane

jiblet
Paranoid (IV) Inmate

From: Minneapolis, MN, USA
Insane since: May 2000

posted posted 04-10-2001 21:38

Well should it say that if you have a semi-colon missing on say the 20th line? I've managed to debug the script, and the problem was a missing semi-colon, and I can't remember if I had any other errors. I didn't see any reason that it wouldn't be able to tell which line was missing a semi-colon.

butcher
Paranoid (IV) Inmate

From: New Jersey, USA
Insane since: Oct 2000

posted posted 04-10-2001 21:41

Any time I get an error (Lord knows that's often), it returns the right line number. It's probably like Bitdamaged said, maybe you didn't close a statement properly. If that's the case, the line number returned with the error, will be the line where PHP thinks the statement starts.

jiblet
Paranoid (IV) Inmate

From: Minneapolis, MN, USA
Insane since: May 2000

posted posted 04-22-2001 07:45

Well after weeks of debugging my scripts by commenting out new sections then adding them one line at a time, I finally figured out what is wrong. Thought it might help someone else some day.

Simply put, PHP judges line numbers not by semi-colons, but by Unix linefeeds. Having edited my files on a Mac, it all appeared to be one line to PHP. Fortunately BBEdit lets you save in Unix format.

« BackwardsOnwards »

Show Forum Drop Down Menu