[TriLUG] error reporting in php.ini

Brad Jorsch anomie at users.sourceforge.net
Tue May 1 09:36:09 EDT 2007


On Tue, May 01, 2007 at 09:18:22AM -0400, Jojo Almario wrote:
> One of the developers I work with wanted to turn on error warnings in
> the php.ini.  Under the Error handling and logging section I went to
> "display_errors" and changed it to "on".  This seemed to work since
> errors were now being displayed, but it was doing it for all sites on
> the server.  Is there a way to turn on display_error for only one
> virtual directory in the php.ini or any other way?

If you're using Apache and mod_php, you should be able to do this in the
vhost config:
  php_flag  display_errors         on

OTOH, if it's a production site this might be better:
  php_flag  display_errors         off
  php_flag  display_startup_errors off
  php_flag  html_errors            off
  php_flag  log_errors             on
  php_value error_log              /path/to/php-writable/logfile


In the individual PHP files, your developer could similarly use
ini_set() to turn it on, although this won't display parsing errors
(since the script has to run before it can process the ini_set()).
"php -l" from the command line should be able to take care of those,
though.



More information about the TriLUG mailing list