View Full Version : Run PHP script every hour?
tparkin
12-07-2005, 05:56 PM
Hi,
Is it possible for me to set up a php script to be executed every hour? Like a cron job or something? If so, how? Thanks in advance.
jondale
12-16-2005, 02:38 PM
I have not tried this but if you have shell access you should be able to add a cron entry by typing
crontab -e
Also don't forget to add the following to the top of your php file
#!/usr/local/bin/php
as well as give your file execute permissions with chmod.
Cron jobs can be setup right from the H-Sphere control panel. It is listed under FTP & Shell Accounts.
crabrock
02-10-2008, 02:50 AM
I'm also trying to set this up. I had it working at my old host but for some reason can't get it here. I think I might be doing the command wrong, so any help would be appreciated.
I put the #! thing in my page, as stated before I had it working at my old host.
Right now I have the settings as
*/5 * * * * /usr/local/bin/php /hsphere/local/home/crabrock/path to file
This is how I had it set up before, but I'm not entirely sure on the path I should be using. Is this the correct way to do it?
crabrock,
The path will be similar to the following:
/hsphere/local/home/username/domain.com/path/to/file
I'm not sure if you were including the domain name already, but it needs to be in the path.
That looks like the right path for PHP and such. If it still doesn't work after double checking the path, I'd probably suggest asking support for more information...
crabrock
02-10-2008, 01:02 PM
yea, i included all that, it was just really long so i took it out of my post.
I copied the file location straight out of my ftp browser, i set the chmod to 777
well rats.
vBulletin® v3.7.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.