Re: Job submission to background and mail results?



Ioannis Michalopoulos wrote:
Hi there!

I wrote a .php script that does a lot of calculations, and I get the
following error message:

Fatal error: Maximum execution time of 30 seconds exceeded in
/home/username/public_html/test.php on line 28

The job I submit will take substantially longer than the 30 seconds of
(Apache?) timeout.

No, PHP timeout more likely (MAX_EXECUTION_TIME in php.ini)



So, I would be happier if I could submit the job together with my email address, see a web message confirming that data was received properly, stop the http connection (so that I do not get the timeout error) and then get an email with the output.

I tried the mail() command and it works fine. I do not know though how
to submit the job so that the http connection is not alive and the rest
of the calculations are done on the background. Please, give me your
advice or send me to the appropriate web site.

Thank you!


If safe_mode is NOT enabled on your server you can change the time limit from within the script itself, using set_time_limit(seconds). If it IS enabled, there is no way to circumvent the preset time limit.


If you have write access to php.ini you could start by setting a higher execution time limit. If that is not the case you probably aren't allowed to start other processes on the server either...
Otherwise you could consider writing the calculations app in C++, Perl or Tcl or Bash scripting or what have you and spawn the process from the PHP script. Email should be sent from that separate app in this case.


Sh
.