Where does PHP's error log reside in XAMPP?

Where does PHP's error log reside in XAMPP?

  1. Blog
  2. 15 November 2026
  3. 4 min read

Stefan Bogdanescu

Founder & Senior Architect

Where does PHP's error log reside in XAMPP?

When debugging a PHP application running on Windows via XAMPP, one of the first places you should look when something breaks is the error log. Unlike production environments where logs might be scattered across various services or centralized systems like ELK stacks, XAMPP simplifies this by bundling configuration and logging paths directly into its installation directory structure. However, knowing exactly where to find them depends on how XAMPP was installed and whether you are targeting php.ini, Apache's error log, or the PHP-specific error stream.

The Standard XAMPP Directory Structure

In a standard XAMPP installation for Windows, the core configuration files and logs reside within the root folder of your installation, typically located at C:\xampp. Within this directory, you will find several subfolders dedicated to specific components: php, apache, mysql (or mysqld), and logs.

The most common location for PHP error logs is inside the logs directory. Specifically, look for a file named php_error_log. This file captures errors defined by your error_reporting settings in php.ini. If you have enabled display_errors in development, you might see output directly in your browser, but turning that off and relying on the log is essential for production-like debugging.

Configuring the Log Path in php.ini

While XAMPP often defaults to a specific path, it does not hardcode the location exclusively; it relies on configuration directives. The primary directive to control this behavior is error_log within your C:\xampp\php\php.ini file.

If you comment out the default line or set it explicitly, you can direct PHP to write logs to a specific directory. For example:

; Default XAMPP path (often commented out or relative)
; error_log = "logs/php_error_log"

; You can override this to point to a custom location
error_log = "C:/xampp/apache/logs/php_error_log"

It is important to note that on Windows, path separators in configuration files should generally be forward slashes (/) or escaped backslashes (\\). Using double backslashes without escaping can sometimes cause syntax errors if not handled correctly by the parser. Always ensure you are editing the active php.ini file, as XAMPP allows for multiple .ini files (e.g., php.ini-development, php.ini-production). By default, XAMPP uses a configuration file named php.ini-development when running in that specific context, so verify which file your server is actually loading.

Distinguishing Apache and PHP Logs

A frequent point of confusion is mixing up Apache's error log with PHP's error log. The Apache error log (usually found at C:\xampp\apache\logs\error.log) records HTTP-level issues like 403 Forbidden, 500 Internal Server Error triggers, or access denied events. In contrast, the PHP error log contains syntax errors, undefined function calls, database connection failures originating from PHP code, and warnings triggered by your application logic.

If you are troubleshooting a "500 Internal Server Error," checking the Apache log first is usually the right move to see if it's an environment issue or a specific PHP exception. The Apache log will often include the last line of the PHP error output if display_errors is off, but for granular debugging, the dedicated PHP error log provides the full stack trace and file context.

Handling Logging Pitfalls

One common pitfall in Windows environments is writing permissions. If you move the log file to a custom directory or change the path in php.ini, ensure that the Apache service (running as a system user) has write permissions for that folder. If you encounter "Permission denied" errors in your logs, check the folder security settings on the target drive.

Additionally, be aware of rotation strategies. Unlike Linux systems where logrotate automatically archives old logs, XAMPP on Windows does not handle log rotation out of the box. As a developer, you must manually manage these files or implement a custom cron job (via Task Scheduler) to prevent the disk from filling up in long-running development instances. Consider setting your error_reporting level appropriately; logging every single warning during a massive data import can quickly bloat the log file size and obscure critical errors.

For developers transitioning from local XAMPP environments to production Laravel applications, understanding these log mechanics is foundational. While modern frameworks offer robust built-in logging drivers, mastering the underlying OS-level logs ensures you can diagnose infrastructure issues before they escalate into application failures.

Our network