Jump to content

I have a PHP scripts with a very long excution time.


andrestander

Recommended Posts

heya all this is my first post,

 

Basically, I have a script that I want it to execute a certain loop that will go on for days or several hours. The delay in execution is intentional and is implemented using the sleep() function.

 

If entered the path to the script in the URL bar and executed it, after I close the tab, would it be still executing in the server? And how do I check it's progress (Like should I implement it to write its progress to a separate text file that I check daily for example)??

 

Thanks in advance.

Link to comment
Share on other sites

yes, no and maybe so ....

 

You may run up against the SCRIPT TIMEOUT (default is 30 seconds) ...

 

If your script executes a shell command ( exec(), virtual() ) - then the shell command will run as long as the OS allows it to run, regardless of your web browser ...

 

We'd really need to know more about what you're trying to do.  Regardless, I can't picture a scenario where you would need to do what you're talking about, or at least in the manner that you're talking about.

 

As far as monitoring .... if you're on a Linux server you could watch the php process with "ps ax" or "top"; on Windows - Taks Manager. That is just watching the process though. Not sure what you're trying to 'watch'.

 

Link to comment
Share on other sites

I have a script that I want it to execute a certain loop that will go on for days or several hours. The delay in execution is intentional and is implemented using the sleep() function.

 

If entered the path to the script in the URL bar and executed it, after I close the tab, would it be still executing in the server?

Terrible idea.

 

As phporcaffeine said, we need to know more about what you're trying to achieve. It sounds like you may want to look into cron.

Link to comment
Share on other sites

Alright, now that I see what you're trying to do - on with the thrashing;

 

I've never been a fan of using PHP, natively, for mass emailing. Among many reasons; the typical mail server that PHP is set to use on an average third party hosted web server, is almost never, never setup the way you would wan't a mass emailing mail server to be setup.

 

Maybe 3 -4 years ago, I would have spent the time to craft a solution but there are way too many alternatives available today. Additionally, with the CAN SPAM Act, it pays to use a service designed to handle mass mailing.

 

Google:

 

Constant Contact

Aweber

iContact

MailChimp

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.