Search code examples
phpcronjobs

How to solve this cron job error directory not found?


I have make one cron job as below

<?php 
echo "HI";
?>

When i ran it using cron job it give me error "?php directory not found"

Please help me regarding this.

Thanks in advance.

Kanji


Solution

  • How do you run it as a cron job? Either you need to run it like

    php my-program.php
    

    Or you need to run it directly (without php) and put the following at the top:

    #!php
    

    In the above examples you need to replace php by the full path to your php instance, which you can find my typing the following on the shell:

    which php