7

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
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Yarin
  • 173,523
  • 149
  • 402
  • 512

3 Answers3

6

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.

JYelton
  • 35,664
  • 27
  • 132
  • 191
  • JYelton- thanks for pointing out my first mistake (I'm an idiot) - I updated my question w the relevant settings- problem is, log_errors WAS set to On, so that wasn't the issue. – Yarin Feb 10 '12 at 16:30
  • I think this is a WAMP-specific problem. Setting log_errors on works (as in, allows Apache to run), but as soon as you also specify the log file... blammo. Apache won't start up. (At least in my case.) – JYelton Feb 10 '12 at 16:39
  • Woot, now to troubleshoot my copy, as this is evidence it *can* work! – JYelton Feb 10 '12 at 16:48
  • Keep in mind I'm using the actual WAMPServer 2.2 software- don't know if you're WAMP setup is the same.. – Yarin Feb 10 '12 at 16:56
  • I have `log_error = On` and `error_log = "c:/wamp/logs/php_error.log"` but WAMP them fails to start. When `error_log` is commented out it starts. Did you manage to solve your issue? – thomthom Dec 28 '12 at 00:43
0

For me it turned out to be a permissions error. I ended up giving EVERYONE full control of the error log file and it seemed to fix my issue. Best of luck.

eklingen
  • 156
  • 1
  • 4
  • While this may solve the problem at first, it might introduce a whole lot of other problems. I'm not a guru when it comes to file permissions, but giving everybody full permissions doesn't sound like a great idea. – Nic Wortel Aug 01 '14 at 07:00
  • I do not recommend this fix. I'd certainly agree that it was not the best solution for security reasons, but if you find yourself in a pinch, it might get you going. At a minimum it will let you know that your issue lies in file permissions. – eklingen Oct 13 '14 at 13:07
0

Did you try adding these lines to your php file?

ini_set("display_errors", "1");
ini_set("log_errors", "1");
ini_set("error_log", "/wamp64/logs/php_error.log");
ashleedawg
  • 20,365
  • 9
  • 72
  • 105
Charix
  • 29
  • 3