Why MAMP doesn't display errors?

2019-01-22 01:08发布

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.

10条回答
We Are One
2楼-- · 2019-01-22 02:08

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

查看更多
啃猪蹄的小仙女
3楼-- · 2019-01-22 02:09

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
查看更多
我欲成王,谁敢阻挡
4楼-- · 2019-01-22 02:10

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

查看更多
再贱就再见
5楼-- · 2019-01-22 02:13

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.

查看更多
登录 后发表回答