Php Cron作业无效,使用crontab -e命令

i want to set a cron job on a server but its not working. I know there are hundreds of links on web that shows how to setup a cron job but i cant seem to make it work. What im doing now is: 1) Running crontab -e. Then it shows bunch of lines in the command line. 2) I go to the bottom and add */5 * * * * path/to/myfile.php and then i exit the editor in command line. Please tell me whats wrong here. Do i need to put my file in a specific folder? or do i need to go to the desired folder and then use crontab -e, or something else. Please forgive me, this is my first cronjob, hoping to be better next time. Here are the pictures of what im doing.

Did you restart the cron service after you updated the file?

Have you tried executing the php script from the command line first to verify that it's executing as expected? It might be that the cron task is executing but the script is failing. If the script is fine, you might want to try using php as a command followed by the path and filename of the php file and then quitting the execution after it's done with -q.

*/5 * * * * php path/to/myfile.php -q 

The problem could well be that you are trying to execute a PHP file and your system is unaware of what to do with it.

Is your PHP file executable?

You can make it executable by running

$ chmod +x file.php

and if you add a shebang to it

#!/usr/bin/php
<?php

// ...

the PHP script can be executed by running

$ ./file.php

Alternatively, you need to run the PHP interpreter and pass it the path to the file as an argument.

$ php file.php

For reference, see: