I've script that can take very long time to complete. Inside a result server responds in 503 error. How do i set longer execution time?

During my PHP script I set:

set_time_limit(0);
ignore_user_abort(true);

Take a look at maximum_execution_time.

However to my understanding this usually must be occur the php.ini , on the brief consider the manual it states this ought to be settable by scripts otherwise in safe mode.

You do not know the precise error? Without them, my prediction may be the memory limit, perhaps you have transformed this too? Look at your php.ini:

memory_limit = 128M

Despite what time-limit you occur the script, an internet request might break earlier since the client surrenders, or because any proxy server in the centre surrenders, or even when the apache server is set up to stop.

Because the other answerer pointed out the maximum_execution_time variable may help, but it might be better should you did not leave the customer waiting having a lengthy delay.

Get a pattern that shows feedback:

  1. User initiates action eg Publish request
  2. PHP Script returns immediately having a page that contains javascript or perhaps an iframe.
  3. The javascript/inner frame calls the lengthy-running script.
  4. Every couple of seconds the javascript updates the consumer how the script is certainly going, utilizing a LONGPOLL-like mechanism.
  5. On completion or error, the javascript notifies and redirects to another page.

This is much like PHP Background Processes. So read that Additionally,

First you have to alter the time period limit in php.ini you cannot change it in the script itself. Or perhaps in .htaccess using php_value

Second, you might be you need to modify the way you communicate with user more friendly to ensure that the page uses an update you are able to explore ajax http-refresh multipart pages for various approaches. If you're doing lengthy information possibly you are able to launch them without anyone's knowledge increase a database, retrieve the outcomes later.