95

I've been using XAMPP for Windows.

Where does PHP's error log reside in XAMPP?

Raptor
  • 51,208
  • 43
  • 217
  • 353
Emanuil Rusev
  • 33,269
  • 52
  • 129
  • 197

14 Answers14

134

\xampp\apache\logs\error.log, where xampp is your installation folder. If you haven't changed the error_log setting in PHP (check with phpinfo()), it will be logged to the Apache log.

Lekensteyn
  • 61,566
  • 21
  • 152
  • 187
  • 3
    This path does not exist in xampp for Linux (Ubuntu 14.04) – Muhammad bin Yusrat Jul 19 '15 at 11:36
  • 1
    For me (macOS), the error log path lives inside the vm (which took me an embarassingly long time to realise). I only know how to access via the xampp control panel terminal, with a path of: `/opt/lampp/logs/php_error_log` – Scott Anderson Apr 13 '19 at 14:16
62

I found it in: \xampp\php\logs\php_error_log

John Conde
  • 212,985
  • 98
  • 444
  • 485
Hovercat
  • 647
  • 5
  • 2
  • 12
    Why was this downvoted? In the newer version of XAMPP, this is the correct directory. – cdmckay Dec 05 '12 at 21:10
  • 2
    Correct, the question should be edited to include a XAMPP version to make the current accepted answer true too... – Frhay Dec 02 '13 at 10:44
  • On my version of XAMPP the root folder is lampp instead of xampp. Otherwise the location is the same. – posfan12 Jan 08 '15 at 00:50
17

You can also open the XAMPP control panel and click on the button Logs:

Enter image description here

Peter Mortensen
  • 30,030
  • 21
  • 100
  • 124
Black
  • 15,426
  • 32
  • 140
  • 232
12

For Mac users, XAMPP version 1.7.3:

/Applications/XAMPP/xamppfiles/logs/error_log
Peter Mortensen
  • 30,030
  • 21
  • 100
  • 124
boksa
  • 213
  • 2
  • 6
8

\xampp\php\logs did not exist at all for me - for whatever reason.

I simply had to create a folder in \xampp\php\ called logs and then the php_error_log file was created and written to.

Strainj1
  • 89
  • 1
  • 2
5

For anyone searching for the PHP log file in XAMPP for Ubuntu, it is:

/opt/lampp/logs/php_error_log

Most probably it will be having a big size (mine was about 350 MBs) and it slowed down my text editor when I opened the file. If you do not care about all the previous logs you can empty the file easily by simply going to the terminal and then writing these three lines one by one:

sudo su 
cd /opt/lampp/logs/
> php_error_log

And newer logs will be easy and fast to open now. The angle bracket empties the file (Works with bash only, doesn't work on zsh).

Muhammad bin Yusrat
  • 1,406
  • 1
  • 13
  • 18
  • What is executing `php_error_log` supposed to do/accomplish? Ask for some application to open the file? Or is the intent different? Can you elaborate? Preferably by [editing (changing) your answer](https://stackoverflow.com/posts/31500869/edit), not here in comments (***without*** "Edit:", "Update:", or similar - the answer should appear as if it was written today). – Peter Mortensen Sep 25 '21 at 18:19
  • Why did you remove the angle bracket? You are editing other people's answer and breaking them without understanding. – Muhammad bin Yusrat Sep 29 '21 at 13:38
3

Look in your configuration file and search for the error_log setting. Or use phpinfo() to find this setting.

greg0ire
  • 22,009
  • 15
  • 69
  • 96
2

You can simply check your log path from phpMyAdmin.

Run this:

http://localhost/dashboard/

Now click PHPInfo (top right corner) or you can simply open this URL in your browser:

http://localhost/dashboard/phpinfo.php

Now search for "error_log"(without quotes). You will get the log path.

Peter Mortensen
  • 30,030
  • 21
  • 100
  • 124
Anubhav
  • 21
  • 1
0

For my issue, I had to zero out the log:

sudo bash -c ' > /Applications/XAMPP/xamppfiles/logs/php_error_log '

redolent
  • 3,957
  • 5
  • 34
  • 43
0

\xampp\apache\logs\error.log is the default location of error logs in PHP.

Peter Mortensen
  • 30,030
  • 21
  • 100
  • 124
  • No. It could also be `/var/log/apache2/error.log`. It may not even be true for XAMPP. On what system was this observed? Windows? – Peter Mortensen Sep 25 '21 at 18:25
0

By default, the XAMPP PHP log file path is in /xampp_installation_folder/php/logs/php_error_log, but I noticed that sometimes it would not be generated automatically. Maybe it could be a Windows account write permission problem? I am not sure, but I created the logs folder and php_error_log file manually and then PHP logs were logged in it finally.

Peter Mortensen
  • 30,030
  • 21
  • 100
  • 124
Yin
  • 1
0

As said in previous answers, you can find the PHP error log in Windows. In C:\xampp\apache\logs\error.log. You can easily display the last logs by tail -f .\error.log.

Peter Mortensen
  • 30,030
  • 21
  • 100
  • 124
Nemo
  • 483
  • 4
  • 21
0

For Mac users, it can be found in:

/Applications/XAMPP/xamppfiles/logs/php_error_log

kodeKhalifa
  • 81
  • 3
  • 6
0

In the current version I've just installed (8.0.11) the installer "forgets" to create the folder C:\xamppp\php\logs, perhaps by design. After creating the folder and restarting Apache the folder will be populated with a php_error.log file.

Follow

To keep seeing the last entry (much like *nix sh tail -f) use the following command:

Get-Content c:\xampp\php\logs\php_error.log -Wait

This will keep reading the file and display the last entries. Quite handy if you are debugging.

theking2
  • 1,498
  • 1
  • 20
  • 28