How to write a Cron job to run a simple php script?


I have a simply php script on my server and want it to be run every 2 minutes using a cron job.

*/2 *   *   *   *

I suspect the command syntax is wrong.

Do I need to add a command before the script url? Another way to run the script?

Any help is very much appreciated.

the cron-job will simply execute a program on the (local) machine.

a URL is NOT a program. it's a link to a ressource.

whether this ressource triggers a PHP-script execution is not of cron's business.

in any case, you could run a cron-job that will periodically visit a given URL. e.g. using the wget command (a "non-interactive web-page downloader")

*/2 *   *   *   *   wget --quiet -O /dev/null