3
votes

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: https://stackoverflow.com/a/16154605/2667307

3
Try to override them in code using: error_reporting(-1); and ini_set("display_errors", "on"); - Naruto
I already tried. Sorry, I have edited it in now. Thanks for your time! @Naruto - Noniq
Did you restart all services after making changes? - Funk Forty Niner
Looks like you're editing the wrong php.ini file - Ravi

3 Answers

4
votes

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.

though,

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

// Report all PHP errors
error_reporting(E_ALL);

and

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

I used to have the same issue. Then i found in MAMP if you go to "File -> Edit Template -> PHP -> ". Edit the file there and restart MAMP.

The issue is that the files reside in two or three places in MAMP on Mac.

0
votes

Changing

error_reporting(E_ALL) ; ini_set('display_errors', 1);

in your PHP script to

ini_set('error_reporting', E_ALL) ; ini_set('display_errors', 1);

will display the errors properly in your browser. As the first alternative should send the errors to your log file.

You can check the manual here: http://php.net/manual/de/function.error-reporting.php