문제

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!

도움이 되었습니까?

해결책

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

다른 팁

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top