105

I've been using XAMPP for Windows.

Where does PHP's error log reside in XAMPP?

Raptor
  • 53,206
  • 45
  • 230
  • 366
Emanuil Rusev
  • 34,563
  • 55
  • 137
  • 201

14 Answers14

143

\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
  • 64,486
  • 22
  • 159
  • 192
  • 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
  • The answer is wrong or icomplete in a way that the ApacheFriends did not think of creating the `logs` folder, shame on them. Create a folder `logs` under `C:\xampp\php` – theking2 Dec 03 '22 at 14:12
64

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

John Conde
  • 217,595
  • 99
  • 455
  • 496
Hovercat
  • 667
  • 5
  • 2
  • 13
    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
18

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

Enter image description here

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Black
  • 18,150
  • 39
  • 158
  • 271
13

\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
  • 139
  • 1
  • 3
12

For Mac users, XAMPP version 1.7.3:

/Applications/XAMPP/xamppfiles/logs/error_log
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
boksa
  • 223
  • 3
  • 6
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,433
  • 1
  • 14
  • 19
  • 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,714
  • 16
  • 72
  • 101
3

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,738
  • 21
  • 105
  • 131
Anubhav
  • 31
  • 2
1

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,738
  • 21
  • 105
  • 131
Yin
  • 11
  • 1
1

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,738
  • 21
  • 105
  • 131
Nemo
  • 503
  • 6
  • 23
1

For Mac users, it can be found in:

/Applications/XAMPP/xamppfiles/logs/php_error_log

kodeKhalifa
  • 320
  • 3
  • 10
0

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

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

redolent
  • 4,159
  • 5
  • 37
  • 47
0

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

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
  • 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

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 but that is ApacheFriends for you. After creating the folder and restarting Apache the folder will be populated with a php_error_log file. No, not a php_error.log but php_error_log, becouse they are your friends.

Follow

Terminal

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.

Code

You might be using vscode so why hot have the errors right at you finger tips. Create a file .vscode\tasks.json

{ 
  // See https://go.microsoft.com/fwlink/?LinkId=733558 
  // for the documentation about the tasks.json format 
  "version": "2.0.0", 
  "tasks": [ 
    { 
      "label": "Monitor php errors", 
      "type": "shell", 
      "command": "Get-Content -Wait c:\\xampp\\php\\logs\\php_error_log", 
      "runOptions": { 
        "runOn": "folderOpen" 
      } 
    } 
  ] 

and allow it to run on start. Make sure you work on a folder, not single files, but you were doing that already, weren't you?

theking2
  • 2,174
  • 1
  • 27
  • 36