Noniq Noniq - 1 month ago 9
PHP Question

How do I enable error reporting in PHP (MAMP)?

So I'm running MAMP on my Mac since I was unable to change my htdocs location to a directory on a local server (no problem to use that local server with MAMP though)

Somehow, php error reporting is disabled for me.
I used phpinfo(); to find the right ini file (which is located at "Applications ▸ MAMP ▸ bin ▸ php ▸ php5.6.10 ▸ conf" in my case) and changed display_errors from "off" to "on" (without the " " of course)

error_reporting is set to E_ALL

However, when I now run phpinfo(); again, Display errors is still turned off.

I have also tried to override those values in the php code without success.

Apparently MAMP overrides the modified php.ini everytime it starts. Source:


Why you are not creating a script with <?php phpinfo() ?> ? by running in browser you'll see Loaded Configuration File This tells you which php.ini file PHP is using like for me it's at /etc/php5/apache2/php.ini

Review below screenshot.


You can try to override it by doing error_reporting(E_ALL);

// Report all PHP errors


if (!ini_get('display_errors')) {
    ini_set('display_errors', '1');