简体   繁体   中英

Running PHP file works correctly when SSH'd in but not via cron

I am looking to see if a file exists on the server using a php file as per below by running "php check-backup"

if (!file_exists("../backups/$today/$hour.sql")) {
    echo "File doesn't exist";
} else {
    echo "File exists";
}

When I run this command on directly on the server when ssh'd in it works perfectly but when this is run as a cron job I cannot get it to find the file.

根据Aynber的评论,我检查了使脚本正常工作的完整路径。

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