MAMP 5 (Nginx) - 如何延長 MAMP 設定中的逾時?

MAMP 5 (Nginx) - 如何延長 MAMP 設定中的逾時?

我有一個運行時間超過預設 60 秒的 PHP 腳本,但頁面傳回 504 網關逾時錯誤。

如何延長逾時時間,以便頁面在 PHP 腳本結束時傳回結果。

我在跑步:

  • 曼普5
  • nginx
  • PHP 7.1.3(已載入)

我查看了其他網站和答案,但因為我正在運行 MAMP,所以我需要添加這些更改的位置不一定相同。

我在一些地方找到了與我的問題類似但不準確的答案。

https://mamchenkov.net

https://www.scalescale.com

https://asdqwe.n​​et

https://stackoverflow.com

我目前所做的改變:

在 MAMP/conf/nginx/nginx.conf 中加入 fastcgi_read_timeout 300 中

location ~* /MAMP[^-]*(.*)$ {
        root             /Applications/MAMP/bin;
        index            index.php;

        location ~ \.php$ {
            try_files        $uri =404;
            fastcgi_pass     unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock;
            fastcgi_param    SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_read_timeout 300;
            include          fastcgi_params;
        }
    }

在 MAMP/conf/php7.1.3/php.ini 更新 max_execution_time = 300

;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

max_execution_time = 300     ; Maximum execution time of each 
script, in seconds
max_input_time = 60 ; Maximum amount of time each script may spend parsing request data
memory_limit = 128M      ; Maximum amount of memory a script may consume (8MB)

我只是有點困惑,如果這些是我應該輸入這些參數的地方,或者是我正在使用的 MAMP 實現的其他地方。請注意,這些變更允許 PHP 腳本在返回 504 回應後繼續運行,但我想完全消除 504 回應。

相關內容