52

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.

kenorb
  • 155,785
  • 88
  • 678
  • 743
Alex McCabe
  • 1,852
  • 2
  • 20
  • 33
  • MAMP or MAMP Pro is not anevironmnet to use for develope or debug web applications. Turn to wampserver64 or xampp to do serous web development. – theking2 Dec 13 '20 at 15:06

10 Answers10

78

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.

pdu
  • 10,295
  • 4
  • 58
  • 95
35

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
Sven
  • 1,450
  • 3
  • 33
  • 58
orhankutlu
  • 820
  • 8
  • 20
  • 2
    Why change two? 1st option seems fine. – Jayden Lawson Jan 04 '16 at 12:19
  • I think I changed the first one and then restarted the service and it worked fine – Tsepo Nkalai Sep 26 '18 at 06:26
  • Mine has two: `/Applications/MAMP/bin/php/php[v#]/conf/php.ini` and `/Applications/MAMP/conf/php[v#]/php.ini`... why are there two?! Why do we need to modify both? Regardless, both have `display_errors = Off`, however, when I go to MAMP > File > Open Template > PHP > v#, it opens a php[v#].ini file that shows `display_errors = MAMP_display_errors_MAMP`... where's that value stored?! If I look at phpinfo(), it shows `display_errors` 'On' for both Local and Master Value. Yet caught Exception shows nothing. This is driving me crazy. – SteveExdia Aug 08 '22 at 21:09
20

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

kenorb
  • 155,785
  • 88
  • 678
  • 743
7

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.

DᴀʀᴛʜVᴀᴅᴇʀ
  • 7,681
  • 17
  • 73
  • 127
jojojohn
  • 725
  • 2
  • 10
  • 19
3

MAMP PRO users can visit the PHP tab in UI and make sure Log Errors: to screen is checked: screencast

Tejus Prasad
  • 6,322
  • 7
  • 47
  • 75
3

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.

CheddarMonkey
  • 449
  • 5
  • 12
  • What version of MAMP is this? – Alex McCabe Sep 24 '18 at 09:25
  • I've got MAMP PRO v5.1. But, I solved it by uninstalling the whole thing and reinstalling. It works again, but not sure for how long. – CheddarMonkey Sep 24 '18 at 21:30
  • 1
    I always find upgrading MAMP to be a nightmare, it never remembers settings. I just don't do it now, despite it's constant protesting. I'm glad you got it working. As long as you don't upgrade, you should be golden. – Alex McCabe Sep 25 '18 at 09:46
2

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.

Andrew Gabriel
  • 102
  • 2
  • 6
  • I've not used MAMP for quite a while now, so I am unsure of the configuration files, so if this is now the correct way of doing things, that's fantastic. Much easier! – Alex McCabe Nov 11 '16 at 10:46
2

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.

Alex McCabe
  • 1,852
  • 2
  • 20
  • 33
  • 1
    This is exactly what worked for me. ```NOTE:``` You must restart the server after changing the ```php.ini``` file for it to take effect – Nate Beers Mar 17 '19 at 08:42
0

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

DᴀʀᴛʜVᴀᴅᴇʀ
  • 7,681
  • 17
  • 73
  • 127
loveNoHate
  • 1,549
  • 13
  • 21
0

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

ste
  • 351
  • 1
  • 3
  • 11