简体   繁体   中英

php/apache: allow larger max_execution_time for a CRON job?

I want run a php script weekly using a cron job, however the script may take a few minutes or more.

Is there any way i can allow a greater max_execution_time just for this script?

Maybe you should try these answers:

But of course, using ini_set("max_execution_time",60) as the first php line in your job's script should do the trick.

Regards, Daniel

如果使用PHP CLI,则不需要设置更高的max_execution_time: http : //nl3.php.net/manual/en/features.commandline.differences.php

You can use set_time_limit() . If you want to disable timeout overall, pass it 0 as an argument. Otherwise pass it the number of seconds of max execution time.

You can use set_time_limit(0) at the start of your code: this removes the execution time limit altogether for this script. Note that it means that the script could run "forever", so put some checks in place in case it hangs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM