Warning: include(/home/blog66rr/public_html/wp-content/plugins/hyper-cache/cache.php): failed to open stream: No such file or directory in /home/blog66rr/public_html/wp-content/advanced-cache.php on line 24

Warning: include(/home/blog66rr/public_html/wp-content/plugins/hyper-cache/cache.php): failed to open stream: No such file or directory in /home/blog66rr/public_html/wp-content/advanced-cache.php on line 24

Warning: include(): Failed opening '/home/blog66rr/public_html/wp-content/plugins/hyper-cache/cache.php' for inclusion (include_path='.:/opt/cpanel/ea-php70/root/usr/share/pear') in /home/blog66rr/public_html/wp-content/advanced-cache.php on line 24
如何解決 apache 的 error log 出現: Script timed out before returning headers 的錯誤訊息 – unethost無限空間虛擬主機 技術分享部落格

如何解決 apache 的 error log 出現: Script timed out before returning headers 的錯誤訊息

最近有客戶使用的套裝程式,因其功能觸發後並無法順利運作,
我們透過error log觀看後發現,其php程式會秀出Script timed out before returning headers的錯誤字串,關於這個狀況在主機端這邊,
是屬於timeout的原因引起,
所以可以著手做下列幾種修正:

以下介紹相關timeout的狀況及大致的解決方向:

1.apache的部份(有兩種改法):

a.如果使用 whm/cpanel系統,則修改
WHM > Apache Configuration > Global Configuration area

b.或是修改httpd.conf:

/usr/local/apache/conf/httpd.conf

 

2.MySQL的部份:

在my.cnf 增加 wait_timeout = 120 (秒數不需過大)。

 

3.PHP的部份 (有三種改法):

a.如果使用 whm/cpanel 系統,則修改:
WHM > PHP Configuration Editor > Options & Information > max_execution_time

b.或是直接修改 php.ini。

c.程式端也加上,也可以順利解決:

<?php
echo ini_get('max_execution_time');
?>

 

4.FastCGI / mod_fcgid的部份(基底是apache):

a.修改的參數(參考用):

<IfModule mod_fcgid.c>
IdleTimeout 1800
IPCCommTimeout 1800
BusyTimeout 1800
ProcessLifeTime 1800
IPCConnectTimeout 20
</IfModule>

b.另一種修改參數(參考用):

<IfModule mod_fcgid.c>
FcgidIdleTimeout 1800
FcgidProcessLifeTime 1800
FcgidBusyTimeout 1800
FcgidIOTimeout 1800
FcgidConnectTimeout 20
</IfModule>

5.PHP-FPM的部份(基底是nginx)

a.需修改nginx.conf

request_terminate_timeout = 0

b.或是

fastcgi_read_timeout 150;

 

以上我們列出相關改法,改完後還是得測試,
並查看error log,才能順利解決問題。

 

(本篇教學由unethost.com客服撰寫)

延伸閱讀:如何備份Cpanel後台安裝的套裝程式?

安裝上述的軟體,我們提供虛擬主機試用,七天滿意保證,
功能完整使用不受限制,歡迎點我申請。