Why MAMP doesn't display errors?

Why MAMP doesn't display errors?

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

Stefan Bogdanescu

Founder & Senior Architect

Why MAMP Doesn't Display Errors

MAMP users frequently encounter a specific configuration trap that renders error reporting invisible. The frustration often stems from the belief that simply editing php.ini should be sufficient, yet the application continues to serve a generic "Server Error" page instead of surfacing the actual PHP exception or warning. This behavior typically indicates that your local environment is not running a standard PHP server instance but rather Apache in a mode where it intercepts output before it reaches PHP's error handlers.

When you inspect your phpinfo() output and see that display_errors is set to Off in the master configuration, yet Local value shows as On, you have identified the root cause: OpCache or APCu.

In older PHP versions (like 5.4.4) and specific MAMP configurations, the error handler might be cached by an extension before your runtime code executes. If the cached bytecode contains a setting that forces errors to be hidden, subsequent changes to php.ini or inline ini_set() calls in your application files will not take effect until the cache is invalidated. This explains why changing the directive in multiple folders yields no immediate result; you are effectively editing configuration for a process that has already compiled and cached its own settings.

To resolve this, you must clear the opcode cache. In MAMP's environment, this is often done by restarting the Apache service entirely, but if OpCache is enabled via .ini files in the www/ directories, a simple restart might not suffice. You need to explicitly disable the cache or clear it programmatically.

Add the following lines to your top-level php.ini or an included configuration file:

opcache.enable = 0
apc.enable_cli = 0

Alternatively, if you are using a modern PHP version where OpCache is enabled by default, ensure that the cache is cleared. You can do this via the command line if you have access to it, or by restarting MAMP with the opcache.revalidate_freq set to -1 and then toggling it off.

Another common pitfall is the interaction between Apache's mod_php and the server's custom error pages. Even if PHP is configured to display errors, Apache might be configured in .htaccess or the main configuration file to suppress them for security reasons. Check your httpd.conf or any included configuration files for directives like:

ErrorDocument 500 /some-custom-page.html
php_flag display_errors Off

These directives take precedence over your PHP settings. You must ensure that display_errors is set to On in both the global php.ini and within any specific .htaccess files located in your project root.

Furthermore, consider the trade-off between development and production environments. Displaying errors directly on the screen is invaluable for debugging but exposes sensitive details like file paths and database queries to potential attackers if deployed to a live server. In a professional workflow, you would typically configure display_errors to Off and log_errors to On in production, redirecting those logs to a file or a centralized logging service. However, for local development on MAMP, keeping display_errors active is essential for rapid iteration.

If you are using Laravel or another framework, ensure that the framework's configuration aligns with your PHP settings. For instance, in Laravel, you can explicitly set error display within the application context:

// In bootstrap/app.php or a similar initialization file
$app->error(function ($exception) {
    // Handle exception
});

While frameworks like Laravel offer robust error handling mechanisms, they respect the underlying PHP configuration. If PHP is hiding errors at the system level, the framework cannot force them to appear unless the server environment allows it.

For developers seeking a more streamlined local development experience without the complexity of managing Apache configurations, switching to a dedicated PHP server can eliminate many of these friction points. Tools like php artisan serve in Laravel or running php -S localhost:8000 bypass Apache's overhead and often provide clearer error output by default.

Ultimately, the issue lies in the hierarchy of configuration precedence. Server-level settings override local file settings, which override application-level ini_set() calls unless the opcode cache is invalidated. Understanding this stack ensures that your debugging efforts focus on the correct layer of the architecture.

Our network