Why MAMP doesn't display errors?

PhpError HandlingMamp

Php Problem Overview


OK this is getting very frustrating. MAMP used to display errors but then stopped. I decided to do a fresh install of it as I couldn't figure it out. I check my PHP version, running 5.4.4 and go to that folder and change the php.ini to this:

error_reporting  =  E_ALL
display_errors = On

Still no errors showing. I go through all the folders and change all php.ini files, just in case. Nothing. I fix the forced error and dump out phpinfo(), check the error section and display_errors is Off. What the hell.

I place error_reporting(E_ALL); ini_set('display_errors', 'on'); at the start of the PHP file and phpinfo() again. Local value is now On, master is still Off. Force a PHP error, and still get Server Error not PHP error.

Anybody have any insight? I have a bug somewhere in some code and cannot find it, would love for PHP to just tell me.

Php Solutions


Solution 1 - Php

MAMP sets up a few different php.ini files for the server, the client etc. Check in your phpinfo() which php.ini actually is read. Looks like you're editing the wrong one.

Solution 2 - Php

There are two php.ini files on MAMP. You should change both php.ini files.

  1. Applications/MAMP/bin/php/'php version you are using(php5.5.10)'/conf/php.ini
  2. Applications/MAMP/conf/php/'php version you are using(php5.5.10)'/conf/php.ini

Then change:

display_errors = Off 

to:

display_errors = On

Solution 3 - Php

If you're using MAMP PRO, you've to enable Error handling (PHP) in the UI interface which should contain at least two the main options: 'Display startup errors' and set output 'To: Display'.

Display startup errors option is equivalent to display_startup_errors (in PHP) and To: Display to display_errors.

See below:

MAMP PRO - Error handling

Solution 4 - Php

Change the setting in your php.ini file. The file is located in MAMP > conf > php5 > php.ini

Look for display_errors = Off and change to display_errors = On

After that you need to restart your Apache and MySQL servers for the change to take effect.

Solution 5 - Php

MAMP PRO users can visit the PHP tab in UI and make sure Log Errors: to screen is checked: http://www.screencast.com/t/EhMpl3aU">screencast</a>

Solution 6 - Php

Here's a 2018 update to this problem. First, I'm having the same trouble and found this thread. I used phpinfo() and found yet another location of a php.ini file. Here are the paths (I work on a Mac):

/Applications/MAMP/bin/php/[php version]/conf/php.ini

/Applications/MAMP/conf/php/[php version]/php.ini

and ...

/Library/Application Support/appsolute/MAMP PRO/conf/php.ini

The phpinfo() page lists two sources for the php.ini:

  • Configuration File (php.ini) Path
    /Applications/MAMP/bin/php/[php version]/conf
  • Loaded Configuration File /Library/Application Support/appsolute/MAMP PRO/conf/php.ini

I ended up changing all three, adding error_reporting(E_ALL) to some pages, restarting the server (even rebooted the machine) and still cant get it to display any error messages.

I'm not sure where to go from here. Any ideas?

**** ---------------------------------------------- **** 2020 Edit **** ---------------------------------------------- **** The latest MAMP upgrade (v6) has changed the main web host directory. It's not in the Applications/MAMP/ directory. That's a good thing. But it required me to change where all my projects live. I had to reconfigure my IDE, Postman, Git, and some others. So, I figured this would be a perfect time to move to Docker containers.

Docker brings a whole new level of challenges but once I got familiar with it and deployed a few containers, it's been great. It feels faster when rendering in the browser and I am more confident that my projects will run as expected on the production server. Eventually our production servers will use containers, so it just makes sense for me.

Solution 7 - Php

If you are using MAMP version 3.2.2 then you only need to change one php.ini file:

Mac: Applications/MAMP/conf/'(php7.0.9)'/php.ini

Windows: C:\MAMP\conf\PHP Version you use'(php7.0.9)'\php.ini

I know this is an old post but MAMP keeps changing their configuration of the files so I hope this helps.

Solution 8 - Php

For newer versions of MAMP, the config file is stored in Appliations/MAMP/bin/php/[php version]/conf.

Andrew Nagy pointed me in the right direction with his answer, but it wasn't quite correct for my installation of MAMP. Why they're different, I can't tell, but here we are.

If anyone is stuck, the easiest thing to do is to just <?php echo phpinfo(); ?> in the index file of the application and look for the loaded php.ini directory.

Solution 9 - Php

Also there is a template saved in MAMP of the php.ini. Go to File > Edit Template > PHP > Your Version.

Solution 10 - Php

On MAMP 3.2.0 and PHP 7 you'll need to target php.ini-production and change the value to Production Value = On

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAlex McCabeView Question on Stackoverflow
Solution 1 - PhppduView Answer on Stackoverflow
Solution 2 - PhporhankutluView Answer on Stackoverflow
Solution 3 - PhpkenorbView Answer on Stackoverflow
Solution 4 - PhpjojojohnView Answer on Stackoverflow
Solution 5 - PhpJoe WatkinsView Answer on Stackoverflow
Solution 6 - PhpCheddarMonkeyView Answer on Stackoverflow
Solution 7 - PhpAndrew GabrielView Answer on Stackoverflow
Solution 8 - PhpAlex McCabeView Answer on Stackoverflow
Solution 9 - PhploveNoHateView Answer on Stackoverflow
Solution 10 - PhpsteView Answer on Stackoverflow