Dear all,
I have a WAMP installation on my machine and I am developing a PHP website in that. Can anyone tell me what settings to be changed in order to show all errors / warning messages in the browser?
Thanks in advance
Dear all,
I have a WAMP installation on my machine and I am developing a PHP website in that. Can anyone tell me what settings to be changed in order to show all errors / warning messages in the browser?
Thanks in advance
Find your php.ini file, scroll down while reading the comments. There is a global setting for enabling/disabling error output. Change it accordingly. Restart your Apache.
Open your php.ini
and search for the option error_reporting
.
Change it to E_ALL & ~E_NOTICE
.
That will show all errors and warnings, but no notices.
Personally I always use E_ALL
on my development machines because often the notices are signs to potential code problems.
You need to set both error_reporting and display_errors. These can be set in php.ini, in Apache (if you're using PHP as an Apache module) or during run-time, though if you set it during run-time then it won't effect some types of errors, such as parse errors.
For portability - that is, if you want to set this in the application - try setting them in an .htaccess:
# note: PHP constants such as E_ALL can't be used when setting it in Apache
php_value error_reporting 2147483647
php_flag display_errors on
Alternatively you could set these in httpd.conf
display_errors makes sure that all reported errors are actually output to the browser (on a live server, it's typical to log them to a file instead). error_reporting specifies which types errors should be logged/displayed.
For a live server, it's generally a good idea to not to display errors publicly (but you may still want to log them). Either way, it's still a good idea to set error_reporting to a more inclusive value (2147483647 being the most inclusive value possible now and for the future according to the PHP docs) because ignoring errors is generally a bad idea.