a-blog cms 3.2 を MAMP にインストールして最後に Internal Server Error になる時には

2025年11月19日

最近、ローカルの macOS MAMP 環境に a-blog cms をインストールしようとすると Internal Server Error になる時がある。 毎回ではなく、稀に発生する。 どちらかといえば稀に成功するという状況に困っていた。

先日、Zoom ミーティングで、これから利用を検討している人に説明しようとライブでインストールしていたらエラーになってしまったりもしていた。

結果としては FastCGI でタイムアウトしていた

/Applications/MAMP/logs/apache_error.log に以下のようにエラーが出力されていた。

[Wed Nov 19 23:09:28.423059 2025] [fastcgi:error] [pid 4064:tid 6169784320] [client ::1:49511] FastCGI: comm with server "/Applications/MAMP/fcgi-bin/php.fcgi" aborted: idle timeout (30 sec), referer: http://localhost/setup/install.php
[Wed Nov 19 23:09:28.423472 2025] [fastcgi:error] [pid 4064:tid 6169784320] [client ::1:49511] FastCGI: incomplete headers (0 bytes) received from server "/Applications/MAMP/fcgi-bin/php.fcgi", referer: http://localhost/ssetup/install.php

FastCGI が 30秒以上データを送信しなかったため、Webサーバー側のFastCGIの制御が「応答なし」と判断して接続を切ってしまっていました。

対策としては

/Applications/MAMP/conf/apache/httpd.conf の設定に FastCGI の設定があります。

<IfModule mod_fastcgi.c>
    # URIs that begin with /fcgi-bin/, are found in /Applications/MAMP/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

    FastCgiIpcDir /Applications/MAMP/Library/logs/fastcgi
    FastCgiServer /Applications/MAMP/fcgi-bin/php.fcgi -socket httpdFastCGI.sock

	AddHandler php-fastcgi .php
	Action php-fastcgi "/fcgi-bin/php.fcgi"
</IfModule>

その中に、

FastCgiServer /Applications/MAMP/fcgi-bin/php.fcgi -socket httpdFastCGI.sock

という行がありますので、その最後に -idle-timeout 300 を追加し以下のようになります。(横にスクロールしないと最後の部分が見えませんが…)

FastCgiServer /Applications/MAMP/fcgi-bin/php.fcgi -socket httpdFastCGI.sock -idle-timeout 300

仕上げに MAMP を再起動することで、これでデフォルトが 30秒だったところを 300秒 待てるようになり、問題なくインストールが毎回正常に終了するようになります。

これでもインストールできない場合

次は php の 30秒設定で引っかかる可能性がある事がわかりました。phpのバージョンによってファイルが変わりますが、PHP 8.3.14 の場合には

/Applications/MAMP/conf/php8.3.14/php.ini

; Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 30

の設定を max_execution_time = 300 に変更してください。

また、a-blog cms の config.server.php のファイルにも MAX_EXECUTION_TIME という設定がありました。

define('MAX_EXECUTION_TIME', 30);

こちらも 300 に変更してみてください。