I'm new to PHP and the whole LAMP stack but I've managed to get it up and running on my Ubuntu 10.10 system. Everything seems to be working with the exception of error reposting in the browser which I just can't seem to get working (and which I can't work without!).
I've read a number of article and other threads which indicate that the following values should be applied in the file /etc/php5/apache2/php.ini
:
display_errors = On
display_startup_errors = On
I've restarted apache2 and even restarted my computer but for the life of me I just can't get it working. I've even tried using phpinfo()
function which reports that these settings are as I've set them so I know it's picking up the correct configuration file but nothing!
Any help would be welcome.
Quickly Show All PHP Errors The quickest way to display all php errors and warnings is to add these lines to your PHP code file: ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL);
The display_errors directive can be set to " on " in the PHP. ini file. This will display all errors including syntax and parse errors that are not displayed by only calling the ini_set function in the PHP code. Note that the display_errors directive must be set to " off " if the application is in production.
To turn off or disable error reporting in PHP, set the value to zero. For example, use the code snippet: <? php error_reporting(0); ?>
Don't just enable the first occurrence of display_errors
in the php.ini file. Make sure you scroll down to the "real" setting and change it from Off
to On
.
The thing is that if you settle with changing (i.e. uncomment + add = On
) by the very first occurrence of display_errors
your changes will be overwritten somewhere on line 480 where it's set to Off
again.
I had the same problem - solved it by setting display_errors = On
in both php.ini
files.
/etc/php5/apache2/php.ini /etc/php5/cli/php.ini
Then restarting Apache:
sudo /etc/init.d/apache2 restart
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With