Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error logging with WAMP server in PHP

I have a WAMP 2.2 server running on a Windows 7 box and cannot get PHP error logging working at all.

The file is always blank even after I explicitly trigger USER_ERROR errors, or cause normal ERROR errors.

I'm including the error relevant sections of the php.ini file - hopefully you can find something:

error_reporting = E_ALL

error_log = "c:/wamp32/logs/php_error.log" ;(UNCOMMENTED BY ME)

log_errors = On
display_errors = On
like image 788
Yarin Avatar asked Feb 10 '12 16:02

Yarin


People also ask

How do I enable PHP error logging?

Enable Error Logging in php. If you want to enable PHP error logging in individual files, add this code at the top of the PHP file. ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); Now, you must enable only one statement to parse the log errors in the php.

How do I view PHP error logs?

Look for the entry Configuration File (php. Find the Error handling and logging section of the php. ini file. Make sure that both display_errors = On, display_startup_errors = On and log_errors = On are present and uncommented. Check the value of error_log - this tells you the location of the file errors are logged to.

Can I delete PHP error log?

It is entirely safe to just delete the php. log file. It will be auto-created the next time it is needed.

What is a PHP error log?

The error_log() function sends an error message to a log, to a file, or to a mail account.


1 Answers

The line ; log_errors is just a comment for the following block, for the purpose of showing you what the settings are in dev vs production. You uncommented four lines which aren't meant to control anything, and I'm surprised your Apache service doesn't have problems starting up because of it.

What you need to do is look for the line:

log_errors = Off

And change the value to On

That said, once you restart the Apache service, the settings should take effect. However, I was unable to get WampServer to properly log php errors despite these settings. Apache will not start up when I specify the error_log parameter.

like image 199
JYelton Avatar answered Oct 19 '22 22:10

JYelton