PHP script Timeout after 45 seconds

I use huge imports to my database (about 200 thousand records), and I had a serious problem with my deadline for importing a script. I used my mobile phone as a stopwatch and found that it expires exactly 45 seconds every pass (internal server error) ... it is only about 200 entries at a time, and sometimes even less. I looked at my phpinfo () and nothing was set for 45 seconds; so I don’t know why that would be so.

My max_execution_time is set to 5 minutes, and the maximum value of max_input_time is 60 seconds. I also tried setting set_time_limit (0); ignore_user_abort (1); at the top of my page, but that didn't work.

It may also be useful to note that my error file reads: "Premature end of script headers" as a runtime error.

Any help is greatly appreciated.

+5
source share
5 answers

I tried all the solutions on this page and, of course, ran from the command line:

php -f filename.php

as Brent says, a reasonable path around him.

But if you really want to run the script from your browser, which allows you to disable the timeout after 45 seconds with an internal server 500 error (as I found when restoring the phpBB search index), then there is a good chance called by mod_fcgid.

I have Plesk VPS and I fixed it by editing the file

/etc/httpd/conf.d/fcgid.conf

In particular, I changed

FcgidIOTimeout 45

to

FcgidIOTimeout 3600

3600 = 1 . , . , 7200 .

, Apache, .

apachectl graceful

HTH -. 6 !

,

+15

, , .

, - Linux, ulimit -a . ulimit -t .

, .

0

-, script , . , 2 , .

php -f filename.php

, ( "Content-type: text/html" ) .

, , , , / . , . , .

0

45 - , , . :

ini_set('memory_limit', '256M');

db, . db ? mssql , " ", 60 . , :

ini_set('mssql.timeout', 60 * 10); // 10 min
0

max_input_time set_time_limit (0)

VPS . , .

  • CSV .
  • 10 () ajax- DB
  • ajax 10 - . script -.
  • Follow the same method until the CSV lines are complete.
0
source

All Articles