Why MAMP doesn't display errors?

前端 未结 10 1098
我寻月下人不归
我寻月下人不归 2020-12-13 08:57

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

相关标签:
10条回答
  • 2020-12-13 09:05

    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.

    0 讨论(0)
  • 2020-12-13 09:07

    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.

    0 讨论(0)
  • 2020-12-13 09:07

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

    0 讨论(0)
  • 2020-12-13 09:11

    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

    0 讨论(0)
  • 2020-12-13 09:15

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

    0 讨论(0)
  • 2020-12-13 09:16

    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.

    0 讨论(0)
提交回复
热议问题