Jae Kun Choi
Jae Kun Choi

Reputation: 2029

PHP script stops after 20-30 seconds

I'm running a script that should run for at least 30 minutes but the script stops after 30 seconds...

I'm not sure why as it worked on other server before.

Is there somewhere I need to check?

Upvotes: 4

Views: 3416

Answers (2)

Daniel Wolfe
Daniel Wolfe

Reputation: 662

You might need to tweak the max_execution_time value in the php.ini file. Keep in mind that installations of PHP often keep a php.ini file for the server and one for the command line interpreter. Make sure that you edit the right one.

http://www.php.net/manual/en/info.configuration.php#ini.max-execution-time

Upvotes: 1

talha2k
talha2k

Reputation: 25493

Use this:

set_time_limit(0); 
ignore_user_abort(true);
ini_set('max_execution_time', 0);

You can also edit php.ini:

max_execution_time = 60; //Maximum execution time of each script, in seconds
max_input_time = 60; //Maximum amount of time each script may spend parsing request data

Hope this helps.

Upvotes: 6

Related Questions