Hi, I've been using some exec() calls in php on linux to process a few images, however, occasionally, one process hangs and starts overloading the server. I know there is a set_time_limit() on PHP scripts, but, I'm wondering if there is a way to limit on the time on exec() calls. Does anyone have any ideas? Thanks -d
It is best to do long processing on the background (and don't let the php script wait on the execution). It would be best to run a script that will process in the background. You can use a cron job to kill programs that run for too long.
AS nocookies said the simpliest way I know to tell you would be to set a cron job that stops the loading process. Although I would change the way your processes are set personally.
On the other hand if you want to trigger the command with exec you can try something like (for linux) : exec('Some command > /dev/null &'); PHP: This will execute the command in the background, and your script will continue running with no problems.
I don't want it to be done in the background. The command should take under 10 seconds, but occasionally goes out of control and runs for minutes. A cron based kill (which I'm already using) kills all the processes, not just the ones that are running long. Ideally, I'd just like to put a time limit on the exec call, just like php already has for the php script part.