php error log missing in XAMPP
Asked Answered
E

3

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
Enlighten answered 6/4, 2017 at 7:1 Comment(0)
B
51

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);
Bronez answered 20/4, 2017 at 19:46 Comment(8)
Thanks so much for posting this!Eldwen
It turns out that just creating the folder is enough, you don't have to stop/start the server.Gass
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 :-)Peria
@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 meDisendow
@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.Pinson
@Zakir_SZH, than I am sorry, I don't know how to help you. Hopefully you succeded by now?!Bronez
@Peria lol funny enough I was also missing the log file. I created the logs folder in C:\xampp\php\logs then added your variable and boom my log file created lol :DValentinavalentine
This just solved my problem.Nonperformance
B
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.

Biedermeier answered 26/7, 2020 at 14:44 Comment(0)
A
-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/

Abuttal answered 6/4, 2017 at 7:46 Comment(4)
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)Enlighten
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?Abuttal
yes server is working absolutely fine. and actual PHP files doesn't have any syntax errors.Enlighten
If a syntax error would occur, PHP would tell you that, regardless of any error log configurationMajestic

© 2022 - 2024 — McMap. All rights reserved.