chewett
New Member
- Messages
- 137
- Reaction score
- 0
- Points
- 0
Im currently using a cron job to run a script each time, So far so good.
It runs the script using the following cron command
But the problem occurs when my file is run, because i have includes in the file.
I am trying to include
/home/chewett/public_html/dir2/file2.php using include($_SERVER['DOCUMENT_ROOT'] . "/dir2/file2.php")
But it always says it cannot find the file. I found a very old topic sugesting to cd to the root of my directory, but after trying this still get the same error
I hope someone can advise me how i should call the command, or how my includes should be set up.
Also, to clarify the script works perfectly fine when run normally
Thanks for any help you might give! +rep for usefulness
It runs the script using the following cron command
PHP:
/usr/bin/php /home/chewett/public_html/dir/file.php >>/home/chewett/public_html/cronlog.txt 2>&1
But the problem occurs when my file is run, because i have includes in the file.
I am trying to include
/home/chewett/public_html/dir2/file2.php using include($_SERVER['DOCUMENT_ROOT'] . "/dir2/file2.php")
But it always says it cannot find the file. I found a very old topic sugesting to cd to the root of my directory, but after trying this still get the same error
I hope someone can advise me how i should call the command, or how my includes should be set up.
Also, to clarify the script works perfectly fine when run normally
Thanks for any help you might give! +rep for usefulness