質問

I have VPS server with godaddy. I am trying to run a cron job but not able to execute it while I can run the same script from browser. I am pasting the message that I got from godaddy crontab manager. Also I am providing the command that I am using to run in cronjob.

0 0 * * *  /home/fyifuse1/public_html/cronjobs/cron_delete_event.php

I want the script named cron_delete_event.php to run everyday.

The error I am getting in email.

/home/fyifuse1/public_html/cronjobs/cron_delete_event.php: line 1: ?php : No such file or directory /home/fyifuse1/public_html/cronjobs/cron_delete_event.php: line 2: include: command not found /home/fyifuse1/public_html/cronjobs/cron_delete_event.php: line 2: : command not found /home/fyifuse1/public_html/cronjobs/cron_delete_event.php: line 3: syntax error near unexpected token (' /home/fyifuse1/public_html/cronjobs/cron_delete_event.php: line 3: $current_date = Date("Y-m-d"); '

Is there anyone who can help me? Thanks in Advance.

役に立ちましたか?

解決

You need to call the PHP executable:

0 0 * * * php /home/fyifuse1/public_html/cronjobs/cron_delete_event.php

You might need to use the full path to PHP which should be available in your control panel or FAQ.

See Godaddy's page for setting up cron jobs

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top