andrestander Posted November 16, 2011 Share Posted November 16, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/251227-i-have-a-php-scripts-with-a-very-long-excution-time/ Share on other sites More sharing options...
phporcaffeine Posted November 16, 2011 Share Posted November 16, 2011 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'. Quote Link to comment https://forums.phpfreaks.com/topic/251227-i-have-a-php-scripts-with-a-very-long-excution-time/#findComment-1288585 Share on other sites More sharing options...
MasterACE14 Posted November 16, 2011 Share Posted November 16, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/251227-i-have-a-php-scripts-with-a-very-long-excution-time/#findComment-1288587 Share on other sites More sharing options...
andrestander Posted November 16, 2011 Author Share Posted November 16, 2011 I need to send a newsletter to my subscribers via Mail. But I don't want to spam anyone or get blacklisted by hotmail or yahoo. So every time the loop executes 500 times(sends 500 email), I delay it a whole hour through sleep(). I use the PHP mail() function too. Quote Link to comment https://forums.phpfreaks.com/topic/251227-i-have-a-php-scripts-with-a-very-long-excution-time/#findComment-1288674 Share on other sites More sharing options...
phporcaffeine Posted November 16, 2011 Share Posted November 16, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/251227-i-have-a-php-scripts-with-a-very-long-excution-time/#findComment-1288713 Share on other sites More sharing options...
andrestander Posted November 17, 2011 Author Share Posted November 17, 2011 Thanks a lot for the help. I'll look these up now. Quote Link to comment https://forums.phpfreaks.com/topic/251227-i-have-a-php-scripts-with-a-very-long-excution-time/#findComment-1288955 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.