PhpStudy+Xdebug调试超时500解决方法 Apache2.4调试时间太短的问题

      发布在:前端技术      评论:0 条评论
<h3 style="box-sizing: border-box; outline: 0px; margin: 8px 0px 16px; padding: 0px; font-family: &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, SimHei, Arial, SimSun; font-size: 20px; color: rgb(79, 79, 79); line-height: 28px; overflow-wrap: break-word; font-variant-ligatures: no-common-ligatures; white-space: normal; background-color: rgb(255, 255, 255);">0x01 问题现象</h3><p style="box-sizing: border-box; outline: 0px; margin-top: 0px; margin-bottom: 16px; padding: 0px; font-size: 16px; color: rgb(77, 77, 77); line-height: 26px; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; font-variant-ligatures: no-common-ligatures; white-space: normal; background-color: rgb(255, 255, 255);">有时再用xdebug调试程序时,由于调试时间过长会出现500服务器错误的现象,根本原因在于apache默认的连接时间过短导致。</p><h3 style="box-sizing: border-box; outline: 0px; margin: 8px 0px 16px; padding: 0px; font-family: &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, SimHei, Arial, SimSun; font-size: 20px; color: rgb(79, 79, 79); line-height: 28px; overflow-wrap: break-word; font-variant-ligatures: no-common-ligatures; white-space: normal; background-color: rgb(255, 255, 255);"><a style="box-sizing: border-box; outline: none; margin: 0px; padding: 0px; font-weight: normal; cursor: pointer; background-color: transparent; color: rgb(78, 161, 219); overflow-wrap: break-word;"></a><a style="box-sizing: border-box; outline: none; margin: 0px; padding: 0px; font-weight: normal; cursor: pointer; background-color: transparent; color: rgb(78, 161, 219); overflow-wrap: break-word;"></a>0x02 适应于</h3><p style="box-sizing: border-box; outline: 0px; margin-top: 0px; margin-bottom: 16px; padding: 0px; font-size: 16px; color: rgb(77, 77, 77); line-height: 26px; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; font-variant-ligatures: no-common-ligatures; white-space: normal; background-color: rgb(255, 255, 255);">中间件:Apache(Fastcgi)</p><p style="box-sizing: border-box; outline: 0px; margin-top: 0px; margin-bottom: 16px; padding: 0px; font-size: 16px; color: rgb(77, 77, 77); line-height: 26px; overflow: auto hidden; overflow-wrap: break-word; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; font-variant-ligatures: no-common-ligatures; white-space: normal; background-color: rgb(255, 255, 255);">错误日志为:End of script output before headers</p><h3 style="box-sizing: border-box; outline: 0px; margin: 8px 0px 16px; padding: 0px; font-family: &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, SimHei, Arial, SimSun; font-size: 20px; color: rgb(79, 79, 79); line-height: 28px; overflow-wrap: break-word; font-variant-ligatures: no-common-ligatures; white-space: normal; background-color: rgb(255, 255, 255);"><a style="box-sizing: border-box; outline: none; margin: 0px; padding: 0px; font-weight: normal; cursor: pointer; background-color: transparent; color: rgb(78, 161, 219); overflow-wrap: break-word;"></a><a style="box-sizing: border-box; outline: none; margin: 0px; padding: 0px; font-weight: normal; cursor: pointer; background-color: transparent; color: rgb(78, 161, 219); overflow-wrap: break-word;"></a>0x03解决办法</h3><ol style="list-style-type: none;" class=" list-paddingleft-2"><li><p>1、打开apache配置文件注释掉如下,并添加一行。</p></li></ol><pre class="brush:bash;toolbar:false"># Various default settings<br/>Include conf/extra/httpd-default.conf 将注释去掉<br/>Include conf/extra/httpd-fcgid.conf 添加此行<br/></pre><ol style="list-style-type: none;" class=" list-paddingleft-2"><li><p>2、更改httpd-default.conf如下内容</p></li><li><pre class="brush:bash;toolbar:false"># Timeout: The number of seconds before receives and sends time out.<br/>#<br/>Timeout 3600<br/><br/>#<br/># KeepAlive: Whether or not to allow persistent connections (more than<br/># one request per connection). Set to &quot;Off&quot; to deactivate.<br/>#<br/>KeepAlive On<br/><br/>#<br/># MaxKeepAliveRequests: The maximum number of requests to allow<br/># during a persistent connection. Set to 0 to allow an unlimited amount.<br/># We recommend you leave this number high, for maximum performance.<br/>#<br/>MaxKeepAliveRequests 0<br/><br/>#<br/># KeepAliveTimeout: Number of seconds to wait for the next request from the<br/># same client on the same connection.<br/>#<br/>KeepAliveTimeout 3600<br/></pre>3、更改php.ini如下内容</li><li><pre class="brush:bash;toolbar:false">max_execution_time = 3600<br/>; Maximum amount of time each script may spend parsing request data. It&#39;s a good<br/>; idea to limit this time on productions servers in order to eliminate unexpectedly<br/>; long running scripts.<br/></pre>4、在extra目录下创建httpd-fcgid.conf,写入如下内容。</li><li><pre class="brush:bash;toolbar:false">ProcessLifeTime 3600<br/>FcgidIOTimeout 3600<br/>FcgidConnectTimeout 3600<br/>FcgidOutputBufferSize 128<br/>FcgidMaxRequestsPerProcess 1000<br/>FcgidMinProcessesPerClass 0 <br/>FcgidMaxProcesses 16 <br/>FcgidMaxRequestLen 268435456 <br/>FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000<br/>IPCConnectTimeout 3600<br/>IPCCommTimeout 3600<br/>FcgidIdleTimeout 3600<br/>FcgidBusyTimeout 60000<br/>FcgidBusyScanInterval 120<br/>FcgidInitialEnv PHPRC &quot;D:\Software\phpstudy_pro\Extensions\php\php5.5.9nts&quot; 此处填写正在使用的php路径<br/>AddHandler fcgid-script .php<br/></pre></li></ol><p><br/></p>
相关文章
热门推荐