如何增加shell命令的执行时间?

时间:2016-05-06 09:52:54

标签: php python cakephp nginx

我正在使用exec()cakephp运行python脚本,在php正在中止之后它工作正常但仍在后台python正在运行以完成该过程。

我正在使用ajax post方法并运行python并等待响应。在此工作流程中,如果python的执行超过30秒,则php不会等待响应。我正在使用nginx服务器。我尝试修改php.ini文件以增加max_execution_time=600。但问题仍然存在。

1 个答案:

答案 0 :(得分:0)

例如使用set_time_limit()

<?php
  set_time_limit(40);//set script's execution time limit to 40 seconds

在大型后台任务中,我通常会申请set_time_limit(0);,这意味着没有时间限制。