skip to Main Content

I am running WordPress code (to import 25 posts) that trips a 500 server error (reported via ajax) after 30 seconds, but the process continues on the server in the background.

For the life of me, I cannot find any evidence of a 30-seconds setting…

php7.4.33.ini…

max_execution_time = 1300
max_input_time = 3000
memory_limit = 512M

apache_error.log is showing pairs of these…

[Sat Apr 22 14:41:31.336668 2023] [fastcgi:error] [pid 10888] [client ::1:59639] FastCGI: comm with server "/Applications/MAMP/fcgi-bin/php7.4.33.fcgi" aborted: idle timeout (30 sec)
[Sat Apr 22 14:41:31.391265 2023] [fastcgi:error] [pid 10888] [client ::1:59639] FastCGI: incomplete headers (0 bytes) received from server "/Applications/MAMP/fcgi-bin/php7.4.33.fcgi"

… though I’m not sure is strictly limited to the 500 events.

This is in Apache’s httpd.conf…

<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
    FastCgiIpcDir /Applications/MAMP/Library/logs/fastcgi
    MAMP_FastCgiServer_MAMP

    <IfModule mod_setenvif.c>
        SetEnvIf Authorization "(.+)" HTTP_AUTHORIZATION=$1
    </IfModule>
</IfModule>

max_execution_time and max_input_time are not in .htaccess

I added…

<IfModule mod_php5.c>
    php_value max_execution_time 300
    php_value max_input_time 300
</IfModule>

… but it didn’t change (though I can’t confirm if I have the php5 module).

Adding this…

<IfModule mod_fcgid.c>
    FcgidIdleTimeout 600
    FcgidProcessLifeTime 600
</IfModule>

… and this…

<IfModule mod_fcgid.c>
    FcgidIdleTimeout 300
    FcgidProcessLifeTime 3600
    FcgidMaxProcesses 128
    FcgidMaxProcessesPerClass 8
    FcgidMinProcessesPerClass 0
    FcgidConnectTimeout 300
    FcgidIOTimeout 300
</IfModule>

… also didn’t change it.

2

Answers


  1. I believe I found answer for your question.

    Just modify the line to state shown bellow and it should be working for you.

    MAMP_FastCgiServer_MAMP -idle-timeout 3600
    

    It’s really weird that MAMP doesn’t have setting for this.

    Login or Signup to reply.
  2. Patrik is correct, but I wanted to clarify where you can find the line that needs changing.

    In MAMP, go to "File" -> "Open Template" -> "Apache" -> "httpd.conf". Search the file for:

    MAMP_FastCgiServer_MAMP
    

    Replace that line with:

    MAMP_FastCgiServer_MAMP -idle-timeout 3600
    

    That’s it. Now your request won’t timeout for 3,600 seconds (1 hour).

    If you right-click Apache and select "Show httpd.conf…", that’s going to bring you to the generated configuration file that’s actually running. You’ll see the MAMP_FastCgiServer_MAMP template replaced with a different line with -idle-timeout 3600 appended to the end:

    FastCgiServer /Applications/MAMP/fcgi-bin/php8.2.4.fcgi -socket fgci8.2.4.sock -idle-timeout 3600
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search