Our blog

 

Automating PHP Scripts Using Cron (Without CLI)

A lot of hosting accounts do not have CLI PHP enabled. If you have some maintainence scripts that you want to run on a regular basis then you can still do this using cron combined with cURL.

For example check out this crontab command:

CODE:
  1. # 0 0 * * * * /usr/bin/curl http://www.mydomain.co.uk/currency_update.php

This will run the currency update script every night.

To edit your crontab simply log into the server via SSH and then type the following command:

CODE:
  1. crontab -e

Hit [i] to go into insert mode. Then type your command. Then hit [esc] to get out of insert mode. Finally type :wq to save the changes and quit.

If your command is not right, you will get a message saying so with an option to try again at editing the file.

More Reading:

 

Leave a Reply