PHP Execution times causing response delays [closed]

ⅰ亾dé卋堺 提交于 2019-12-02 16:41:37

问题


I am intentionally running a php script that last up to 60 seconds on my server with a delay between each run. The issue is that any other requests sent to the server while the script is executing are delayed until the script finishes.

Is there anyway to 'thread'(?) php to allow apache to take requests that require php while the script is running?


回答1:


Apache and PHP will by default serve many concurrent connections just fine. I'll take a stab into the dark and guess that you are starting a session. The default session handler is file based, and will acquire an exclusive lock on the session file, which blocks all concurrent requests that try to use that same session file. Close the session before you go off doing long-running tasks with session_write_close.



来源:https://stackoverflow.com/questions/22483668/php-execution-times-causing-response-delays

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!