Long Script, emailed when done?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Todd_Z
Forum Regular
Posts: 708
Joined: Thu Nov 25, 2004 9:53 pm
Location: U Michigan

Long Script, emailed when done?

Post by Todd_Z »

I have a script that is very time consuming, what I want to do is when the user submits the information, a php script is run which then sends results to the inputted email address. I want the php script to run just on the server though, with no interaction with the user, meaning they don't have to stare at a progress bar for 20 minutes while the script runs. Any clues on how to do this?
User avatar
Buddha443556
Forum Regular
Posts: 873
Joined: Fri Mar 19, 2004 1:51 pm

Post by Buddha443556 »

There are plenty of ideas in Program Execution Functions.

Probably need these:

Code: Select all

set_time_limit(0); // 0 = unlimited time
ignore_user_abort(true);
Have you considered using a cron to run the process? With a cron you could limit the number of processes running to suit your resources and schedule processing for off-peak times. Maybe a bit more complicated to code though.
User avatar
Todd_Z
Forum Regular
Posts: 708
Joined: Thu Nov 25, 2004 9:53 pm
Location: U Michigan

Post by Todd_Z »

Well using cron jobs, it would run at every x interval, but I would just like for it to run immediately when the user submits the info, and then allow the user to navigate around the site while the script runs, im gonna try the ignore abort idea - thanks!
Post Reply