D
D
dj_vadim2016-03-05 21:55:14
CodeIgniter
dj_vadim, 2016-03-05 21:55:14

How to increase the execution time of a php script?

There is a script that works with the API of a certain server, selects a lot of data with gradual requests, then selects child data for each data block and forms an array in which several operations are then performed.
The script always runs for 300 seconds, but more time is needed, at least 10 minutes. Attempts to increase or remove the restriction did not lead to anything. Still get error
Fatal error: Maximum execution time of 300 seconds exceeded in C:\OpenServer\domains\........
Here's what I've tried:
In php.ini

max_execution_time = 86400
max_input_time = 86400

At the beginning of the script:
set_time_limit(0);
ini_set('MAX_EXECUTION_TIME', 86400);
ini_set('MAX_EXECUTION_TIME', -1);

Working on CodeIgniter 2 under OpenServer 4.8.8 and php 5.4

Answer the question

In order to leave comments, you need to log in

6 answer(s)
D
dj_vadim, 2016-03-09
@dj_vadim

Question tagged CodeIgniter
In the folder /system/core/CodeIgniter.php on line 127 there is an internal limit set_time_limit(300) which was not so easy to find)

M
Melkij, 2016-03-05
@melkij

Run such scripts in the console.
For CLI SAPI, the runtime limit is always disabled.

S
Silm, 2016-03-05
@Silm

See apache or nginx settings. See what you have there.

I
Igor Vorotnev, 2016-03-05
@HeadOnFire

Both php and the server (nginx/apache/etc) have limits. You have changed in one place only.

A
Alexander, 2016-03-06
@Rekk1

Write to the database, then work with it with another script.

L
Leonid Smirnov, 2019-04-14
@SunyJun

Here is the answer to your question - https://www.pandoge.com/stati_i_sovety/kak-uvelich...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question