1

I have some question on server response max execution timeout.

If, I called server API to running something huge and not able to finish within time limit set in server php.ini max_execution_time config, will the process in server still continue to process? - if so, will it process endless? - if not, is the process stop immediately or canceling loop one by one and finish all process.

In my experience, when I receive max execution timeout on local hosting, the data is already process.

So I not sure it is because it is stuck on response until timeout or server is continue running after throw max execution timeout exception.

Yu Yenkan
  • 745
  • 1
  • 9
  • 32

4 Answers4

1

It really depends on what your PHP code is like.

Usually the code execution will halt. You can alter this behaviour using ignore_user_abort().

Nikola Petkanski
  • 4,724
  • 1
  • 33
  • 41
1

PHP interpreter runs scripts against php.ini configuration and checks max_execution_time = 500 and max_input_time = 500.

PHP doesn't continue to run the script after the max_execution_time. It's simply "kills" the script.

What can also happen, script starts a database query, normally query will run on database server until finished no-matter what happens to the script. Also you may get a Gateway Timeout coming from the web server, for Apache check httpd.conf and look for the setting Timeout.

If you need to run a script that takes time to execute, a lot more then the rest of your website, you should call a web page, PHP on server, fork a new process as a background executed script (the PHP part that takes lot of time), inform user via async status updates or sending an email that processing ended. You should not extend max_execution_time for all script just for one exception.

  • I checked my `php.ini`,` max_input_time=-1` and `max_execution_time=30`, so script is stop after 30 sec? I don know what will be affect when `max_input_time` set to unlimit – Yu Yenkan Mar 01 '18 at 09:46
0

It doesn't continue after the exception is thrown. It's simply cut when the time is up.

Anything before the time out is executed. If not designed especially to precent this.

buckyBadger
  • 236
  • 1
  • 6
0

The process won't continue and stop immediately after the time limit set in server php.ini max_executiontime config has been reached then php throw a max execution timeout exception.

Here (How to increase maximum execution time in php) if you want to increase maximum execution time in php file.

shafrianadhi
  • 642
  • 5
  • 8