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条)

报告相同问题?

悬赏问题

  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)