Increase time for file to run

7 posts / 0 new
Last post
#1 Wed, 08/10/2011 - 03:12
Fredrik-s

Increase time for file to run

Hello,

I have a .php-file that I run four times a day with a cron job. The .php-file goes thru multiple pages searching for a certain text. And it needs a lot of time to get it's job done.

When I run the script I get a "500 Internal Server Error".

Where can I increase the maximum time for the script to get run? I think it hits the roof for taking to long time and then I get the "500 Internal Server Error".

/Fredrik-s

Wed, 08/10/2011 - 10:11
andreychek

Howdy,

You may want to take a peek at $HOME/etc/php.ini, and make sure the "max_execution_time" is set high enough for your script to run.

-Eric

Wed, 08/10/2011 - 19:31
tpnsolutions
tpnsolutions's picture

Fredrik-s,

It should also technically be possible to this on a script by script basis:

ini_set('max_execution_time',60); # set execution to 60 seconds

-Peter

Best Regards,
Peter Knowles | TPN Solutions
Email: pknowles@tpnsolutions.com | Skype: tpnassist
Sun, 08/21/2011 - 14:10
Fredrik-s

I still get 500 Internal Server Error.

I have changed the following in $HOME/etc/php.ini:

max_execution_time = 900 ; Original 60 Maximum execution time of each script, in seconds max_input_time = 900 ; Original 60 Maximum amount of time each script may spend parsing request data ;max_input_nesting_level = 64 ; Maximum input variable nesting level memory_limit = 700M ; Original 128M Maximum amount of memory a script may consume (128MB)

Any other clue?

Sun, 08/21/2011 - 14:29
Fredrik-s

I found the trick.

It was the following line in the path way: Webmin > Servers > Apache Webserver > "Pick your Virtual Server, and click Virtual Server infront" > "Click Change Directives" > "Find the following line and increase":

IPCCommTimeout

Is original set to 31 (which means 31 seconds) increase this.

Tue, 01/24/2012 - 10:52
bleck

Thank you for the trick. Saved my life !

This IPCCommTimeout parameter can be accessed and modified from Virtualmin :

virtualim > my_server > Server Configuration > Website Options > Maximum PHP script run time

Fri, 09/12/2014 - 03:20 (Reply to #6)
chandru_chs

You Saved me too! thanks for valuable tips

This virtualim > my_server > Server Configuration > Website Options > Maximum PHP script run time helped me in overcome of php max execution time.

Topic locked