I have a php script that need to be processed for one to 5 hours (sending newsletters to our customers). I tried both set_time_limit(2000);
and ini_set('max_execution_time', 360000);
but neither works. They work perfectly on the XAMPP local server, but they do not work on our dedicated server (Unix & Apache). I also changed the Apache timeout to 300 (which was 50), yet after 30 seconds of script running, it returns this:
Internal Server Error Page (Error 500)
I have no idea if there is any other place for timeout and/or why the server does not honor the ini_set()
or set_time_limit()
functions. We are using Unix CentOS 6 and Plesk 11.9 as server. I also changed the default php.ini max_execution_time
, and it works…
I read many articles and forums, yet I don’t know why this happens. I appreciate your help.
4
Answers
I appreciate your answers and comments. I setup the cron job, and it works perfect. I also have tried the chunk-chunk (150 emails per chunk) approach, and that one works too.
a better way would be using
ini_set()
orset_time_limit()
at the top of the script which sends newsletters to the customers…you should not try to main config files…and also, as someone suggested above, cron jobs are good fit for such situations..// add, in your php file header or config
Good work!
If you using Vps:
Edit your php.ini file:
Then, run command line to restart apache
Or header file
Good luck!