Reputation: 169
php.ini contains following parameters:
track_errors=On
error_reporting=E_ALL & ~E_DEPRECATED & ~E_STRICT
log_errors=On
error_log="C:\xampp\php\logs\php_error_log"
but "logs" folder is missing in this path. Its not even hidden folder. where to find php error logs?
OS:windows 8.1
php version 5.6.24
Upvotes: 17
Views: 30348
Reputation: 679
Somehow PHP won't create the "logs" folder by itself... and that's what we need to do:
Created the "logs" folder in the correct location (for instance, C:\xampp\php\logs
).
Restart Apache using XAMPP control panel (stop and start).
Then when an error occurs the file will be generated fine and you'll be again able to open the PHP logs from XAMPP console
To test that it's working you can create a fatal error by using
trigger_error("Some info",E_USER_ERROR);
Upvotes: 51
Reputation: 141
In my case I solved this problem by making the main settings made in the question, with only two changes:
track_errors=On
error_reporting=E_ALL & ~E_DEPRECATED & ~E_STRICT
log_errors=On
change 1:
error_log="C:\xampp\php\logs\php_errors.log"
in the documentation it says that these methods are deprecated, so it is disabled by default and with the wrong directory.
change 2:
Create the folder 'logs' in: C:\xampp\php
This worked for me, I hope it will be useful.
Upvotes: 4
Reputation: 896
If you are sure that you are using the right config option to set the log path, it might be that PHP is not writing to the error log because of a certain type of syntax error. Put your code through a syntax checker like http://phpcodechecker.com/
Upvotes: -1