tags:

views:

1414

answers:

4

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

+1  A: 

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.

Fuzzy76
+1  A: 

First click on the wamp icon in the task panel. Then click on the 'PHP' folder followed by the 'PHP settings' folder. Make sure 'expose PHP' and 'display errors' are both checked. You can set other error settings like 'track errors' and 'display startup errors' as well.

A: 

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.

DR
I would indeed leave notices on. It's nice to know when your using undefined variables since they usually mean you've made a typo.
Pim Jager
+4  A: 

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.

thomasrutter