kevinkhan Posted September 29, 2011 Share Posted September 29, 2011 when i insert this code into my php script my cron job wont work include($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'facebook' . DIRECTORY_SEPARATOR . 'globalFunctions.php'); it is giving this error Warning: include(/facebook/globalFunctions.php) [function.include]: failed to open stream: No such file or directory in /home/cork/public_html/facebook/fbFriendAdder/all/addFrndOfFrnd.php on line 13 Warning: include() [function.include]: Failed opening '/facebook/globalFunctions.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/cork/public_html/facebook/fbFriendAdder/all/addFrndOfFrnd.php on line 13 what is causing this problem and why does it work fine when i run the script manually?? Link to comment https://forums.phpfreaks.com/topic/248099-cron-job-failing-when-i-include-a-file/ Share on other sites More sharing options...
MarPlo Posted September 29, 2011 Share Posted September 29, 2011 Hi If the page in which you include the file is in "facebook/fbFriendAdder/all/" directory, try use this include: include('../../globalFunctions.php'); Link to comment https://forums.phpfreaks.com/topic/248099-cron-job-failing-when-i-include-a-file/#findComment-1274028 Share on other sites More sharing options...
trq Posted September 29, 2011 Share Posted September 29, 2011 The $_SERVER array doe snot exist when using php's cli. Link to comment https://forums.phpfreaks.com/topic/248099-cron-job-failing-when-i-include-a-file/#findComment-1274218 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.