PDA

View Full Version : Running an Automatic PhP Script


Mikel Jones
06-15-2010, 06:39 AM
I want to be able to run a script every morning at 7:00am. Is threre any way through PhP to schedule scripts?

I called my hosting company and short of buying the 50 to 300 a month package they had no way to schedule either backups of my MySQL database or run a PhP script on an interval.

I did a search and found a couple of threads on cron jobs but they seem to need access to the server and I don't have that being hosted and all.

Anyone have any pointers to keywords or threads that will point me in the right direction?

Sades
06-15-2010, 06:54 AM
First if your server is linux they should have cron jobs unless they restrict that to thier clients wich will make them a bad hosting company, and if your working with a windows host it use a library called scheduale task, now a good hosting company, would give you any of the options to set things up on their control panel, try finding a hosting provider that gives you cpanel for linux server wich is easy to set up a cronjob, the only way you can accomplish runing a script the way you want is that your hosting provides you with those functions.

In the worse case you can get the service with other companys like http://www.cronjobs.org/ wich will call you file script and execute it giving the correct url of it on your host.

Mikel Jones
06-15-2010, 07:24 AM
First if your server is linux they should have cron jobs unless they restrict that to thier clients wich will make them a bad hosting company, and if your working with a windows host it use a library called scheduale task, now a good hosting company, would give you any of the options to set things up on their control panel, try finding a hosting provider that gives you cpanel for linux server wich is easy to set up a cronjob, the only way you can accomplish runing a script the way you want is that your hosting provides you with those functions.

In the worse case you can get the service with other companys like http://www.cronjobs.org/ wich will call you file script and execute it giving the correct url of it on your host.



Thank you. I guess I need to call them back. :)

Mikel Jones
06-15-2010, 07:33 AM
Thank you. I guess I need to call them back. :)

Yep, you were right!

The guy I called the first time at GoDaddy didn't know his xxx from a hole in the ground. They have something called "Cron Manager" and I have access to it from their hosting control panel. I just logged in and set up the job. Easy squeezy!

Thanks again for the pointers.

Sades
06-15-2010, 08:46 AM
NP you should of mentioned at the first time it was godaddy hosting service they all give you the options to run the cronjob i suggest you test it first to see if it runs ok with a 5 minutes timer then set it up to run every day at the time you need, this suggestions is from my own experience that some times making the cronjob command is diferent on each hosting company depending on thier control panel, also check their help files on the correct way on how to use the settings to make a cronjob or automated task.

Mikel Jones
06-15-2010, 08:48 AM
NP you should of mentioned at the first time it was godaddy hosting service they all give you the options to run the cronjob i suggest you test it first to see if it runs ok with a 5 minutes timer then set it up to run every day at the time you need, this suggestions is from my own experience that some times making the cronjob command is diferent on each hosting company depending on thier control panel, also check their help files on the correct way on how to use the settings to make a cronjob or automated task.

Will do and thanks again.