Forum Moderators: coopster

Message Too Old, No Replies

No Error Page Generated when PHP Syntax is wrong

         

alanv72

6:22 am on Jan 20, 2004 (gmt 0)

10+ Year Member



I am running Slackware 9.1 with the latest PHP and MySQL server. Is there some option in the MySQL, PHP, or Apache that will return an error message when you try to open a page that has an error in syntax? Right now if I have one thing wrong on the page it just comes up as blank white space. It would be helpful if I could get it to do like ASP and tell me what line the error is on. It's hard looking thru 300 lines of code to find the you typed "=" instead of "==" (real occurance).

Thanks to anyone that can help.

Also, I just wanted to say that I'm glad I found this forum. I've been reading and have learned alot already. Thanks for the time invested by everyone that posts!

RonPK

2:16 pm on Jan 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi alanv72, welcome to WebmasterWorld.

Try using the error_reporting function:
error_reporting(E_ALL);
That should report all errors, warnings and notices.

Using = instead of == is not a syntax error - it is bad programming and will not be reported ;)

coopster

2:34 pm on Jan 20, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Another warm Welcome to WebmasterWorld, alanv72!

It's a common mistake -- assignment instead of equality evaluation -- happens to even the best now and again.

You may also want to check out the PHP Troubleshooting [webmasterworld.com] thread in the PHP Forum Library [webmasterworld.com]. There are some good tips there as well.

alanv72

3:01 pm on Jan 20, 2004 (gmt 0)

10+ Year Member



Thanks for the quick response guys.

error_reporting(E_ALL);

Sweet, so that's a PHP command you embed in the page right?

coopster

3:04 pm on Jan 20, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Right [php.net]. Usually right at the top so you can catch 'em all ;)

alanv72

4:31 pm on Jan 20, 2004 (gmt 0)

10+ Year Member



I was still having trouble with this.. I found that the server was set to display_errors = off... So it was just logging all of the errors and not displaying them..

I have it fixed now.

Thanks again for the help.

coopster

6:17 pm on Jan 20, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Exactly. The display_errors [php.net] directive is mentioned in the Error Handling and Logging Functions area of the PHP Troubleshooting [webmasterworld.com] link mentioned earlier.

Nice work, glad you got it all nailed down.