5

I can't get my setup to display PHP errors. The only thing I see is the WSOD.

I've updated my php.ini file:

(excerpt from phpinfo())

display_errors          On      On
display_startup_errors  On      On
error_reporting         30719   30719

Any ideas?

Yves Van Broekhoven
  • 344
  • 1
  • 3
  • 13
  • 1
    *(tip)* set `error_reporting` to `-1` to enable all error levels, current and future. – Gordon Feb 07 '12 at 08:30
  • 1
    I know this does not answer the original question but it might help you out in the mean while: Did you try checking the PHP error log? – KillerX Feb 07 '12 at 08:30
  • 2
    You sure it's not overruled in your script? What happens if you call a simple script like this? `ini_set('error_reporting', E_ALL); ini_set('display_errors', 1); echo $some_fake_var;`. Should throw a: `Notice: Undefined variable: some_fake_var`. – Oldskool Feb 07 '12 at 08:50

2 Answers2

5

If you're using the default installation of Apache in OSX you need to edit /etc/php.ini however if you're using a MacPorts install you will need to edit /opt/local/etc/php5/php.ini

You state your phpinfo() is showing that errors are enabled. If they are not displaying they must be being overridden.

Places to check

  • httpd.conf, httpd-vhosts.conf, and other config files in /etc/apache2/extras (not sure on MacPorts paths) - Look for php_value lines.
  • .htaccess files - Again look for php_value lines.
  • .user.ini files - PHP 5.3+ supports per directory configuration like Apache.
  • Your scripts themselves. They may implement custom error handlers that turn off error reporting with ini_set.

You can try enabling at a script level using the following:

ini_set('error_reporting', -1);
ini_set('display_errors', 1);
ini_set('html_errors', 1); // I use this because I use xdebug.

0:: // My favourite kind of error.
Leigh
  • 12,859
  • 3
  • 39
  • 60
0

You can turn error reporting on for a single script with this one liner, Making no permanent changes to config files.

error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
raam86
  • 6,785
  • 2
  • 31
  • 46