12

I'm running across a problem developing a site locally using OS X 10.10 and MAMP Pro 3.0.5 with PHP 5.5.10. Accessing both the site front-end and the back-end admin interface is throwing an error 500 Internal Server Error.

The MAMP Apache log is showing multiple instances of the following error:

[Mon Nov 10 14:03:04 2014] [error] [client 127.0.0.1] FastCGI: comm with server "/Applications/MAMP/fcgi-bin/php5.5.10.fcgi" aborted: idle timeout (30 sec), referer: http://jtp.dev:8888/admin/entries/project
[Mon Nov 10 14:03:04 2014] [error] [client 127.0.0.1] FastCGI: incomplete headers (0 bytes) received from server "/Applications/MAMP/fcgi-bin/php5.5.10.fcgi", referer: http://jtp.dev:8888/admin/entries/project

Once this happens, I can't continue working until I restart my machine. Restarting my Mac and restarting MAMP fixes the error temporarily, but it eventually reappears and prevents me from being able to view the site locally.

Has anyone got any ideas about what may be causing this?

  • I see that somebody else once had this problem - see the third post down in the right hand column at plus.google.com/107199334932455999203/posts – Alex H Nov 10 '14 at 15:07
  • Does this happen on long-running requests like updating, for example? Seems like it's some FastCGI timeout error. – Brad Bell Nov 10 '14 at 18:08
  • No, it happens at random times, for instance it happened yesterday when attempting to view a particular field group. – Alex H Nov 11 '14 at 9:09
  • Seems to be the same error with a potential resolution here: stackoverflow.com/a/15565267/684 – Brad Bell Nov 11 '14 at 18:41
  • Not seeing this error anymore, but didn't do anything to fix it! – Alex H Nov 17 '14 at 17:07
20

Following the answer in this issue https://stackoverflow.com/questions/15563217/apache2-fastcgi-comm-with-dynamic-server-aborted-first-read-idle-timeout/15565267#15565267 I was able to successfully run my script without this dreaded timeout and 500 error, like so:

  1. Go to File > Edit Template > Apache > httpd.conf
  2. Do a Find & Replace for MAMP_FastCgiServer_MAMP
  3. Comment out the line MAMP_FastCgiServer_MAMP
  4. Add a config line for your version of PHP, with the desired timeout limit at the end like so: FastCgiServer /Applications/MAMP/fcgi-bin/php5.6.2.fcgi -idle-timeout 3600

For your version of PHP the code block would look like this, with the two changes being the second and third last lines:

<IfModule mod_fastcgi.c>
    # URIs that begin with /fcgi-bin/, are found in /var/www/fcgi-bin/
    Alias /fcgi-bin/ "/Applications/MAMP/fcgi-bin/"

    # Anything in here is handled as a "dynamic" server if not defined as "static" or "external"
    <Directory "/Applications/MAMP/fcgi-bin/">
        SetHandler fastcgi-script
        Options +ExecCGI
    </Directory>

    # Anything with one of these extensions is handled as a "dynamic" server if not defined as
    # "static" or "external". Note: "dynamic" servers require ExecCGI to be on in their directory.
    AddHandler fastcgi-script .fcgi .fpl

    MAMP_ActionPhpCgi_MAMP

    #MAMP_FastCgiServer_MAMP
    FastCgiServer /Applications/MAMP/fcgi-bin/php5.5.10.fcgi -idle-timeout 3600
</IfModule>

Also reference this solution: https://stackoverflow.com/questions/24715426/how-do-you-increase-the-apache-fastcgi-timeout-on-mamp-mamp-pro/24976009#24976009

  • Thank you very much, pi_ron! After trying to increase every possible memory and timeout in php and mysql settings, this finally helped! – Hannes Kirsman Nov 5 '15 at 13:16
  • Lifesaver. Such a random error. You saved me hours of troubleshooting. Thanks. – Ian Nov 25 '15 at 13:35
  • 1
    Hi, I have the same error but I have different php versions running (local MAMP Pro of course) for different sites. I solved the problem for a php7 local site by adding the following line FastCgiServer /Applications/MAMP/fcgi-bin/php7.0.0.fcgi -idle-timeout 3600 But if I add a similar line for another version: FastCgiServer /Applications/MAMP/fcgi-bin/php5.6.10.fcgi -idle-timeout 3600 I cannot start the Apache server and the error log is also empty. I tried letting also different versions of php defined in there, but none of the others worked except for php7. – zarun Jan 27 '16 at 17:39
  • Has anyone tried just adding -idle-timeout 3600 to the end of the MAMP_FastCgiServer_MAMP line? – PaulSkinner May 6 '16 at 8:57
  • 1
    @eballeste I can't recall how I came to this answer last year, however I've added a reference to your solution as well. I definitely have no interest in plagiarism for any kind of gain on Stack Exchange, and was only trying to share the solution I found for something that was very frustrating for me back when I used MAMP. – pi_ron Aug 30 '16 at 5:51
2

I get this from time to time. I'm not sure of the specific errors in the logs as it hasn't happened for a while. But when it does then switching MAMP to use the same PHP for all hosts (so not FastCGI), load the site, then switch back to use FastCGI seems to magically "fix" it.

  • Weird issue on MAMP Pro applying this fix the issue was solved, but if you have others apps on the same MAMP, need to switch every time. – Didierh Jun 13 '18 at 23:57
1

The reason of this problem vary on different situations.

I recently installed/configured xdebug over MAMP and in template php.ini file as shown in snapshot enter image description here, i wrote zend_extension = /Applications/MAMP/bin/php/php5.5.26/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so which is wrong because if we successfully install xdebug over loading MAMP, it automatically writes this line just after [xdebug] line; therefore on generating php.ini, it wrote the same line 2 times. I removed my hard-coded line from php.ini template file and my issue was resolved.

I hope it will help someone.

1

My solution is similar to @mohsin-mr's answer. I disabled XDebug (MAMP Pro > PHP tab > uncheck Debugger) and the FastCGI errors went away.

protected by Community Aug 8 '17 at 15:22

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.