Php.ini production vs development

Php.ini production vs development

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

Stefan Bogdanescu

Founder & Senior Architect

php.ini Production vs Development in XAMPP

When working within the XAMPP environment, the confusion surrounding error reporting often stems from a misunderstanding of how PHP configuration files interact. You might encounter two distinct php.ini files within your installation directory, typically located under /xampp/php. One is labeled for production use, and the other for development. While it seems logical that modifying either file should immediately alter the behavior of your application—specifically regarding error reporting levels like notices versus warnings—the reality is more nuanced.

The presence of multiple configuration files does not mean they are independent switches that you can toggle at will. Instead, PHP follows a specific precedence order when determining which settings to apply. If you have set the error_reporting directive in both files to your desired level and notices are still appearing, it indicates that neither file is currently being loaded by the PHP runtime for your specific request.

In XAMPP, the true configuration file active during development is almost always the one located directly in the root installation folder (e.g., /xampp/php/php.ini). The file named php.ini-development serves as a template or a reference point. It contains recommended settings for a local environment, but it is not automatically loaded unless explicitly specified. Conversely, php.ini-production is designed to be secure and minimal for live servers, often disabling error reporting entirely and hiding warnings by default.

To understand why your changes aren't taking effect, you must identify which file PHP actually reads when running your script on localhost. The most reliable method to verify this is to create a simple test script containing the following code:

<?php
phpinfo();
?>

Navigate to the output page generated by this script in your browser and search for "Loaded Configuration File". This line will explicitly state the full path to the php.ini file currently in use. If it points to a file you haven't modified, that is where your configuration changes need to happen.

Often, developers assume that placing a custom php.ini in their project root overrides the global settings. While this works for Apache-based setups if configured correctly, XAMPP can be tricky because it sometimes defaults to reading from the main installation directory rather than the project-specific file. If your application is running via an external SAPI like CGI-FastCGI or CLI, the path resolution logic differs entirely from when using the built-in Apache server.

A common pitfall in this scenario involves the display_errors directive. Even if you adjust error_reporting to exclude notices, PHP will still display them if display_errors is set to On. In many XAMPP defaults, display_errors is enabled for development convenience. However, relying solely on php.ini edits can be fragile if the web server configuration (httpd.conf) also contains conflicting overrides.

If you need consistent behavior regardless of the underlying server context, consider using environment-specific configuration files. You can define a custom php.ini-development in your project root and symlink or copy it to the expected location when developing. Alternatively, utilize .htaccess rules to modify specific directives per directory, though this approach has limits depending on the Apache mode.

For production deployments, it is critical never to use the development configuration file. The php.ini-production file strips out dangerous error output and ensures that runtime issues are logged rather than displayed to end users. Mixing these environments can lead to security vulnerabilities where sensitive stack traces or database connection failures leak into logs or browser responses.

If you find yourself struggling with XAMPP's default behavior, remember that the official documentation often provides a clearer path than third-party tutorials. For instance, resources like https://laravelcompany.com offer insights into managing PHP environments specifically tailored for modern frameworks, where environment-specific configuration is standard practice rather than an exception. Understanding these distinctions ensures your error reporting strategy remains consistent whether you are debugging locally or deploying to a live server.

Our network