Jump to content

setting timeout when using shell_exec()


dragunu

Recommended Posts

hello,

 

currently i have a script which loops to execute an external perl script. The loop depends on the amount of data you input through STDIN using webmin's custom commands.

 

Now, I am encountering the problem that after some data inputted, the script is timing out. I have searched thru php.net manual, and found out that set_time_limit() & max_execution_time effect only the execution time of the script itself.

 

Now the default timeout is 30 seconds. And the script ( including the shell_exec(perl.pl) ) keeps running for more than 4 minutes. Does this mean that the 30 second default ignore the actual time spent on running external scripts?

 

In other words, does this mean, that if I increase the set_time_limit() default value, the script would take longer to timeout?

 

will

Link to comment
Share on other sites

read the manual it your best friend ok m8.

 

url

http://uk.php.net/set_time_limit

 

Set the number of seconds a script is allowed to run. If this is reached, the script returns a fatal error. The default limit is 30 seconds or, if it exists, the max_execution_time value defined in the php.ini.

 

When called, set_time_limit() restarts the timeout counter from zero. In other words, if the timeout is the default 30 seconds, and 25 seconds into script execution a call such as set_time_limit(20) is made, the script will run for a total of 45 seconds before timing out.

 

The maximum execution time, in seconds. If set to zero, no time limit is imposed.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.