Relative path not working in cron PHP script

Change the working directory to the running file path. Just use

chdir(dirname(__FILE__));
include_once '../your_file_name.php'; //we can use relative path after changing directory

in the running file. Then you won’t need to change all the relative paths to absolute paths in every page.

Leave a Comment