dongzha3058 2013-07-24 02:58
浏览 240
已采纳

运行PHP脚本90秒后内部服务器错误500

have a php script that runs for a few minutes. It creates a lot (up to 10000) of small (2-20K) files on the server.

For some reason, after approximately 90 seconds, I always get a 500 Internal Server Error. I thought it might be some php.ini problem, so I edited some values there:

max_execution_time = 1000
max_input_time = 1000
default_socket_timeout = 1000
memory_limit = 400M
post_max_size = 100M
file_uploads = On
upload_max_filesize = 100M

I also checked to see if these new settings occurred by using phpinfo(), and have seen that they did take effect.

What else can I do/change in order to make my script work?

PHP5.5 Windows Server 2008 R2, SP1, Unfortunately, only 600 MB of physical memory Nothing in errors_log.

  • 写回答

2条回答 默认 最新

  • douqiao8370 2013-07-24 03:38
    关注

    In hope to save other people's hair (I pulled out pretty much of my own on this one)

    The solution is to increase the FastCGI activity timeout.
    Use appcmd, the IIS 7 command line tool, to modify the IIS configuration XML file.

    Run cmd in an administrator mode.

    To check the current settings use:

    %windir%\system32\inetsrv\appcmd list config -section:system.webServer/fastCgi
    

    To add the activity timeout (assuming CGI location is C:\php\php-cgi.exe):

    %windir%\system32\inetsrv\appcmd set config -section:system.webServer/fastCgi /[fullPath='C:\php\php-cgi.exe'].activityTimeout:600
    

    This output now should be similar to this: -

    <system.webServer>
    <fastCgi>
    <application fullPath="C:\PHP\php-cgi.exe" activityTimeout="600" instanceMaxRequests="10000">
    <environmentVariables>
    <environmentVariable name="PHP_FCGI_MAX_REQUESTS" value="10000" />
    </environmentVariables>
    </application>
    </fastCgi>
    </system.webServer>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改