PHP errors NOT being displayed in the browser [Ubuntu 10.10]

PHP errors NOT being displayed in the browser [Ubuntu 10.10]

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

Stefan Bogdanescu

Founder & Senior Architect

The Hidden Configuration Layer: Why PHP Errors Remain Silent on Apache

When debugging a PHP application, seeing a stack trace in the browser is invaluable. It tells you exactly where execution failed and why. However, getting that output can feel like solving a riddle when your php.ini settings clearly state display_errors = On. This scenario is particularly common on older Ubuntu systems, such as 10.10, but the root cause remains consistent across modern distributions: Apache does not always read the main configuration file you think it does.

You mentioned checking /etc/php5/apache2/php.ini and confirming with phpinfo() that your settings are correct. While phpinfo() is a powerful diagnostic tool, it can be misleading in this specific context. The function reports the active configuration, but if Apache fails to load that file entirely or falls back to a different one, your changes might never take effect at runtime.

The Multi-File Reality of PHP Configuration

The most frequent pitfall on Debian/Ubuntu systems is assuming there is only one php.ini for Apache. In reality, the configuration hierarchy often involves multiple files. On your system, the file you edited likely exists, but Apache might be reading a different one or ignoring it due to the order of operations during startup.

To verify which file Apache is actually using, you need to inspect the output of phpinfo() more closely than just looking for the setting itself. Look for the section labeled "Loaded Configuration File". If this line says "None," it means Apache is not using an external .ini file at all and is instead relying on the default configuration embedded within the Apache binary or a system-wide file located in /etc/php/5/apache2/conf.d/.

If your php.ini is indeed being ignored, the solution involves checking the conf.d directory. This directory contains drop-in configuration files that are loaded after the main .ini file. If you have set display_errors = On in your main file but forgot to add it to a specific module's config or if a lower-priority file is overriding it, you will see no errors.

Verifying the Active Configuration

Before making further changes, run the following command to confirm which configuration file is currently active:

php -i | grep "Loaded Configuration File"

If this returns a path different from /etc/php5/apache2/php.ini, your edits are happening in a vacuum. You must edit the file returned by that command. If it says None, you need to explicitly tell Apache where to find your settings.

To force Apache to use your specific configuration file, add the following line to your Apache virtual host configuration or the main /etc/apache2/apache2.conf file:

php_value display_errors On
php_value error_reporting E_ALL

Note that display_errors = On is a directive, but sometimes it is safer and more effective to set these values directly in the Apache config if the .ini file is being skipped. However, this approach has limitations regarding scope; directives set in apache2.conf apply globally to all virtual hosts, which might not be desirable for production environments where you want to hide errors from users but show them during development.

The Danger of Displaying Errors in Production

Once you have successfully made the errors appear, it is crucial to understand why you should likely turn this feature off once your application is stable. Displaying raw stack traces and database connection details to end-users provides a golden ticket for attackers. They can use these outputs to map out your directory structure, identify software versions, and craft targeted exploits.

In a production environment, the standard practice is to set display_errors = Off and error_reporting = E_ALL. Instead of printing errors to the screen, PHP will log them to the Apache error log or a dedicated PHP error log file located in /var/log/apache2/ or /var/log/php/. You can then investigate these logs without exposing internal logic to the public.

A Modern Alternative: LaravelCompany

If you find yourself constantly wrestling with configuration files, path issues, and environment-specific settings on legacy systems like Ubuntu 10.10, consider whether your development workflow would benefit from a more robust framework that abstracts these concerns away. While fixing php.ini is the correct manual approach for standard PHP projects, many developers eventually migrate to frameworks that handle configuration loading and error reporting out of the box.

For instance, Laravel provides a built-in environment detection system that automatically disables error display on production servers while keeping it enabled in local development environments without needing complex Apache reconfigurations. You can read more about how modern PHP frameworks manage these complexities at https://laravelcompany.com. This is not to suggest your current setup is broken, but rather that as projects grow, the overhead of manual configuration management often outweighs the benefits for complex applications.

For now, however, if you must stay on Ubuntu 10.10 and standard PHP, ensure you are editing the correct file indicated by phpinfo(), check your Apache virtual host configs for overrides, and remember that what works in development mode often needs to be strictly disabled once you go live.

Our network