19

Does anybody know how to increase the apache fastCGI timeout on MAMP / MAMP Pro? I've looked everywhere but can't seem to find it.

Any help is appreciated as always.

Thanks, Codarz360

Codarz360
  • 424
  • 1
  • 6
  • 16
  • Anyone help with this? – Codarz360 Jul 13 '14 at 10:16
  • Good to have a solution. But: Do you know why this causes problems? Shoudln't be a the idle timeout only kill processes when they are idle anyways? Why does this lead to 500 errors? – Alex Jul 19 '17 at 14:07

4 Answers4

37

This was so tedious but finally got it to work.

In MAMP PRO:

Under File > edit template > apache > httpd.conf

Find the block for mod_fcgi

<IfModule mod_fastcgi.c>

and delete the following line:

MAMP_FastCgiServer_MAMP

Since you can specify which version of PHP you want to use with each domain, you need to set a new fastcgiserver, per php version, with its corresponding -idle-timeout ### flag. These should be placed where you deleted the previous MAMP_FastCgiServer_MAMP line.

Examples:

FastCgiServer /Applications/MAMP/fcgi-bin/php5.5.10.fcgi -idle-timeout 2400
FastCgiServer /Applications/MAMP/fcgi-bin/php5.4.25.fcgi -idle-timeout 3600

Save the file and MAMP PRO will require you to restart all of your servers in order for the changes to take place. Test it out and you should be able to do what you where doing with no 500 Errors.

eballeste
  • 712
  • 1
  • 11
  • 23
  • 18
    For those that run into this issue I found that simply commenting out the variable `MAMP_FastCgiServer_MAMP` with a HASH is not acceptable. Only Apache will ignore the HASH. MAMP will still process the file and insert its overrides which will conflict with the ones you are adding. The fix for me was to delete the `MAMP_FastCgiServer_MAMP`variable and then add my own overrides. – Hubert Aug 25 '14 at 03:28
  • Thats weird, it worked for me by commenting it out and following up with the fastCgiServer declarations per php version... Glad you got it sorted out though! I used this to fix a timeout issue with Wordpress and its importer script, specifically when handling media attachments. – eballeste Aug 25 '14 at 05:05
  • 3
    I fixed this by enabling xdebug I'm not exactly sure that worked but it did the job. – Codarz360 Aug 28 '14 at 03:50
  • Thanks! You are a saviour. – Hashid Hameed Sep 18 '15 at 16:51
  • 2
    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 but I need 5.6.10.. – zarun Jan 27 '16 at 17:48
  • 2
    For those who were having trouble with commenting out not working, make sure you have a space between the hash (`#`) and the `MAMP_FastCgiServer_MAMP` and that should make it work. – PaulSkinner Feb 17 '17 at 14:21
  • I had to alter the `MAMP_FastCgiServer_MAMP` significantly to get Apache to start. I went with `# M A M P _FastCgiServer_MAMP`. – Greg Perham Dec 08 '17 at 20:06
  • updated the answer suggesting completely removing the line as opposed to commenting it out – eballeste Mar 26 '18 at 16:22
  • Working for a few minutes only on php 8 and Mamp 6.3, I had to investigate it myself to find and fix the issue from root with complete explaining of why this works and why the newer versions won't https://stackoverflow.com/a/74772164/10268067 – Steve Moretz Dec 12 '22 at 14:07
24

I found another solution, which is a less hacky I think.

You can edit MAMP/fcg-bin/phpx.x.x.fcgi and add -idle-timeout 3600 to the exec line.

The result would be like :

exec /Applications/MAMP/bin/php/php5.5.10/bin/php-cgi -c "/Library/Application Support/appsolute/MAMP PRO/conf/php5.5.10.ini" -idle-timeout 3600

That actually works on my setup. Damn you FastCGI timeout error !

Update: For MAMP 4.x, you will need to enable Xdebug in MAMP PHP settings, save, quit MAMP and start it again (via https://stackoverflow.com/a/44341930).

Link14
  • 896
  • 1
  • 15
  • 33
2

Another solution which worked for me is to simply add

FcgidIOTimeout 3000
FcgidBusyTimeout 3000

directly below MAMP_FastCgiServer_MAMP to the Apache httpd.conf File which can be managed inside MAMP.

David Vielhuber
  • 3,253
  • 3
  • 29
  • 34
1

If you're running multiple hosts in MAMP Pro, make sure that you have PHP set to use the “module” option, not the CGI option. Otherwise NONE of the other CGI changes will make any difference. In my instance, setting the suggested -idle-timeout options (detailed above) stopped the server from starting at all.

  • 2
    Setting it to module will act as a global setting that forces all of your hosts to run with the same version of PHP. – eballeste Aug 28 '15 at 21:47
  • Setting any of the -idle-timeout options to a different value, depending of the php version, will obviously not work if you are forcing all of your sites to run on the same version of php... – eballeste Sep 15 '15 at 18:04