PDA

View Full Version : Can't display PHP errors


mur
08-19-2004, 01:10 PM
Hi all,
This is my first post so don't blame me too much ;)

I'm installing some php-based webapps and I've realized that I can't see any errors.

I've tried to overwrite the default config using ini_set, error_reporting and set_error_handler functions, but I can't see anything when a error occurs. Any help/guide/tip?

Thanks in advance...

Chris
08-19-2004, 02:34 PM
Hey mur,

Actually, you have complete access to your php.ini file and you can set it up however you like.

Here is what I recommend:

Your php.ini file is located here:

/ftp/lib/php.ini

Change this:

; Log errors into a log file (server-specific log, stderr, or error_log (below))
; As stated above, you're strongly advised to use error logging in place of
; error displaying on production web sites.
log_errors = Off

To this:

; Log errors into a log file (server-specific log, stderr, or error_log (below))
; As stated above, you're strongly advised to use error logging in place of
; error displaying on production web sites.
log_errors = On

Change this:

; Log errors to specified file.
;error_log = filename

To this:

; Log errors to specified file.
error_log = /var/log/httpd/error_log

Then restart your VDS or restart Apache from the command line:

/etc/rc.d/init.d/apachectl restart

So, now we are logging our PHP errors to the error_log.

You can view this log file, live over a SSH connection, with this command:

tail -f /var/log/httpd/error_log

This is how we track PHP errors in our development. We do not recommend printing errors to the screen. I hope this is helpful.

mur
08-19-2004, 10:50 PM
Your answer has been very helpful Chris, thank you very much :)

Anyway, is there any possibility to redirect broken pages to a "generic error page"? (you know, a blank page can be dissapointing for some users :D ).

mur
09-03-2004, 02:34 PM
I'll take your silent as a "no, that's not possible" answer.

Thanks anyway. :cool:

Chris
09-04-2004, 11:33 AM
Sorry for the silence, but yes, I don't know if you can redirect broken pages to a "generic error page". I don't believe this is possible.