Question

I'm setting up a crontab. When accessing the php file directly (domain.com/file-path/file.php) it works perfectly. When accessing it through shell (php -f /var/www/vhosts/domain.com/file-path/file.php) I get include file errors all over the place. It has something to do with the include path being set as: (include_path='.:')

Is there an argument I can pass through shell to set the include_path? Or is there something I can put in file.php to fix the error? I'm trying to avoid going through all documents related to this and fixing the include path to be absolute.

Thanks!

Was it helpful?

Solution

try duplicating your login environment by sourcing all profile files, or see what include_path is current set to and set it appropriately in the before using php. Either method will require you to write a short script

OTHER TIPS

You could modify your cron entry to first change to the appropriate directory and then execute the command:

cron: * * * * * cd /home/user/rest/of/path ; /usr/local/bin/php file.php
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top