简体   繁体   中英

command cron to run php file

I trie to run a php file. The hoster allow me to write just a file name, I cant' change

php -f /home/a4833978/

. I tried this but the file don't run 在此处输入图片说明

Use * * * * * instead of 1 1 * * * if you want your script to run every minute. Your example would run once a day at 01:01.

In case you really want to run it once a day, check if your script works when executed directly.

Your issue is probably in your php file. If you do it in the way you did, all of your php includes will be messed up.

try to do it like this

cd /dir1/dir2/dir3/prod/update/ && php updater.php

also, make sure that files have executable tag on them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM