'How can I keep the connection between Apache and PHP alive on long running scripts?
So here's my problem. I have a PHP script that imports big CSV Files into a Database, running as a Cronjob on Apache. It worked fine but as the files get bigger I now get FastCGI Errors and the script is not running to the end. I asked my Web-Hoster and they told me I need to use "KeepAlive" or "Apache Communication" in my script during the runtime because the Apache would close the connection thinking the PHP Script is not running anymore, as the script just reads data from files, formats the data and then writes it into the Database. During that process the Timeout must happen. I cannot use "KeepAlive" directives via .htaccess, and I tried just echo something after each processed line, but it did not help. And I don't have access to apache.conf or php.conf, I have limited permissions on the php.ini though. Any help would be great, as I am out of ideas right now. :/
Solution 1:[1]
you say that you can not modify the PHP ini file to increase the connection timeout duration, so if that is not an option you should split the CSV files into smaller files and modify your php script accordingly to process the CSV files individually
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | mister_cool_beans |
