17

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

3 Answers 3

52

Somehow PHP won't create the "logs" folder by itself... and that's what we need to do:

  1. Created the "logs" folder in the correct location (for instance, C:\xampp\php\logs).

  2. 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

XAMPP PHP logs

To test that it's working you can create a fatal error by using

trigger_error("Some info",E_USER_ERROR);
Sign up to request clarification or add additional context in comments.

7 Comments

It turns out that just creating the folder is enough, you don't have to stop/start the server.
I like the trigger_error trick, I didn't know about it. I've always achieved this with $kaboom=3/0; to get a Division by zero error :-)
@ValRob you need to check your php.ini. The default location should be C:\xampp\php. create here the folder logs. This solved the problem for me
@jos-luijten dear sir, i have tried your solution.. but still not logs comes in that folder and also php (on browser) does not showing any error :(. I have checn my php ini and all settings are correct there.
@Zakir_SZH, than I am sorry, I don't know how to help you. Hopefully you succeded by now?!
|
4

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.

Comments

-1

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/

4 Comments

i haven't made any changes in php.ini, so this doesn't seems like syntax error in php.ini. moreover my php files doesn't show any syntax error in provided link.("php. ini " can't be checked in this link)
I am talking about the actual PHP file. Like I said, with some syntax errors it might be that the error is just not logged. If it is the standard, unedited php.ini file, I doubt that there are any errors. Is the PHP/WebServer process starting fine?
yes server is working absolutely fine. and actual PHP files doesn't have any syntax errors.
If a syntax error would occur, PHP would tell you that, regardless of any error log configuration

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.