This is a discussion on Automated Server Scripts at Intervals within the PHP Language forums, part of the PHP Programming Forums category; Our company has developed a web-app that needs the ability to run a regular maintenance PHP script and use ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Our company has developed a web-app that needs the ability to run a
regular maintenance PHP script and use it also send out SMS/Email alerts on a regular basis, say at exactly 9AM and 2PM without user interaction. We're using shared hosting at the moment, so we have no access anything more than our file directory on the server and our database. To resolve this I've created a small vb.net app that accesses the maintenance script on our server at the preset times, which sends out the email and everything as it should. This is functional for now but I see this as a short-term solution considering the possible unreliability of running an app outside of the server on a home/office computer, also the possible security risks involved. I was wondering if anyone knew of a better solution. We're going to be upgrading to a dedicated server within a few months and surely there is a way for the server to automatically run a php script at regular intervals? Maybe I'm just looking for the most difficult solution, but any help would be appreciated. |
|
|||
|
enko wrote:
> > Our company has developed a web-app that needs the ability to run a > regular maintenance PHP script and use it also send out SMS/Email > alerts on a regular basis, say at exactly 9AM and 2PM without user > interaction. We're using shared hosting at the moment, so we have no > access anything more than our file directory on the server and our > database. To resolve this I've created a small vb.net app that accesses > the maintenance script on our server at the preset times, which sends > out the email and everything as it should. This is functional for now > but I see this as a short-term solution considering the possible > unreliability of running an app outside of the server on a home/office > computer, also the possible security risks involved. I was wondering if > anyone knew of a better solution. We're going to be upgrading to a > dedicated server within a few months and surely there is a way for the > server to automatically run a php script at regular intervals? Since you are upgrading to a dedicated server, I think the problem is not worth solving now. Just make sure you take appropriate precautions against accidentally running the maintenance script too often (have the script keep a log of its activity and do nothing unless it's time for the next run). Also, when you do upgrade, it's probably a good idea to run your script from the command line... Cheers, NC |
|
|||
|
"enko" <mbyrd1332@gmail.com> wrote in message news:1141409357.429781.247610@e56g2000cwe.googlegr oups.com... > We're going to be upgrading to a > dedicated server within a few months and surely there is a way for the > server to automatically run a php script at regular intervals? Maybe > I'm just looking for the most difficult solution, but any help would be > appreciated. Once you've got your dedicated server, the daemon you want it called crond if it's Linux, or the Task Scheduler if it's Windows. Either way, you need to call 'php myscript.php'. However, make sure your script doesn't expect to use Apache/IIS-specific stuff, or PHP will bail out. If you speak very nicely with your hosts, they might set this up for you temporarily now, on the grounds that you're going to upgrade to a dedicated server soon anyway. Jon |
|
|||
|
"Jonathan Wiltshire" <news@jwiltshire.org.uk> wrote in message
news:AS1Of.70291$m13.60862@newsfe5-gui.ntli.net... > > "enko" <mbyrd1332@gmail.com> wrote in message > news:1141409357.429781.247610@e56g2000cwe.googlegr oups.com... >> We're going to be upgrading to a >> dedicated server within a few months and surely there is a way for the >> server to automatically run a php script at regular intervals? Maybe >> I'm just looking for the most difficult solution, but any help would be >> appreciated. > > Once you've got your dedicated server, the daemon you want it called crond > if it's > Linux, or the Task Scheduler if it's Windows. Either way, you need to call > 'php myscript.php'. > However, make sure your script doesn't expect to use Apache/IIS-specific > stuff, or > PHP will bail out. > > If you speak very nicely with your hosts, they might set this up for you > temporarily now, > on the grounds that you're going to upgrade to a dedicated server soon > anyway. Provided the new server is with them :-P > Jon > |
|
|||
|
On Fri, 03 Mar 2006 21:15:15 +0000, d wrote:
>>> We're going to be upgrading to a >>> dedicated server within a few months and surely there is a way for the >>> server to automatically run a php script at regular intervals? Maybe >>> I'm just looking for the most difficult solution, but any help would be >>> appreciated. >> >> Once you've got your dedicated server, the daemon you want it called >> crond if it's >> Linux, or the Task Scheduler if it's Windows. Either way, you need to >> call 'php myscript.php'. >> However, make sure your script doesn't expect to use Apache/IIS-specific >> stuff, or >> PHP will bail out. >> >> If you speak very nicely with your hosts, they might set this up for you >> temporarily now, >> on the grounds that you're going to upgrade to a dedicated server soon >> anyway. > > Provided the new server is with them :-P But most hosts would do it now on the fact the client says "we're going to be going dedicated in 3 months and will be considering your company for that, in the meantime would you....." It may help if you get a sexy-sounding lady to call for you :-) Cheers, Andy -- Andy Jeffries | gPHPEdit Lead Developer http://www.gphpedit.org | PHP editor for Gnome 2 http://www.andyjeffries.co.uk | Personal site and photos |
|
|||
|
"Andy Jeffries" <news@andyjeffries.co.uk> wrote in message news:pan.2006.03.05.10.43.37.455006@andyjeffries.c o.uk... > > But most hosts would do it now on the fact the client says "we're going to > be going dedicated in 3 months and will be considering your company for > that, in the meantime would you....." > > It may help if you get a sexy-sounding lady to call for you :-) > Exactly. They'll probably be a lot more helpful if they think you'll go dedicated with them. J |
|
|||
|
enko wrote: > We're going to be upgrading to a > dedicated server within a few months and surely there is a way for the > server to automatically run a php script at regular intervals? Maybe > I'm just looking for the most difficult solution, but any help would be > appreciated. Hello, I've only had to deal with doing this on a shared hosting, so the solution might be different than on your dedicated host, but you can set up something called a cron job, which will run a script at a particular time, or interval. I use a simple interface, through my host's control panel, but you can also program cron jobs through the command line. Chris S. Free Web Design Tools http://www.impliedbydesign.com/free-...e-scripts.html |