interlog Posted October 4, 2008 Share Posted October 4, 2008 I set up a cron job and it isn't working properly. Part of it, but it stops and errors out when I try to include another php file. This is part of the script that stops the action: // Do the PM Stuff define('IN_PHPBB', true); $phpbb_root_path = $_SERVER['DOCUMENT_ROOT']."/"; $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.' . $phpEx); include_once($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx); $linkMJ = mysql_connect("localhost","****","****"); $dbMJ = mysql_select_db("painsb_phpbb3", $linkMJ); for ($i=1;$i<=$user;$i++){ if ($Flag[$i]<>""){ $queryMJ = "SELECT * FROM phpbb_users WHERE username ='$Flag[$i]'"; $resultMJ = mysql_query($queryMJ, $linkMJ); while ($rowMJ = mysql_fetch_array($resultMJ)){ $Subject ="Your lottery ticket has expired!"; $message = "Your lottery ticket has expired. Please renew it before midnight to enter the draw for tomorrow"; $pm_data = array( 'from_user_id' => '316', 'from_user_ip' => '127.0.0.1', 'from_username' => 'Off Topic Lounge', 'enable_sig' => true, 'enable_bbcode' => true, 'enable_smilies' => true, 'enable_urls' => true, 'icon_id' => 0, 'bbcode_bitfield' => 1, 'bbcode_uid' => 1, 'message' => $message, 'address_list' => array('u' => array($rowMJ['user_id'] => 'to')), ); //Now We Have All Data Lets Send The PM!! submit_pm('post', $Subject, $pm_data, false, false); } } } Executing it by typing the file into the browser results in no erros, however the minute it is run as a cron job, the following error occurs: Warning: include(../common.php): failed to open stream: No such file or directory in /home/painsb/public_html/lottery/drawnumbers.php on line 133 Warning: include(../common.php): failed to open stream: No such file or directory in /home/painsb/public_html/lottery/drawnumbers.php on line 133 Warning: include(): Failed opening '../common.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/painsb/public_html/lottery/drawnumbers.php on line 133 Warning: include_once(../includes/functions_privmsgs.php): failed to open stream: No such file or directory in /home/painsb/public_html/lottery/drawnumbers.php on line 134 Warning: include_once(): Failed opening '../includes/functions_privmsgs.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/painsb/public_html/lottery/drawnumbers.php on line 134 Fatal error: Call to undefined function submit_pm() in /home/painsb/public_html/lottery/drawnumbers.php How do I rectify this? It appears that the path to the included files are not correctly defined when running through cron. For your information, this file is only to run through cron, it will never be executed through browser access. Many thanks in advance for your help. Mark Link to comment https://forums.phpfreaks.com/topic/127042-php-cron-job-help/ Share on other sites More sharing options...
genericnumber1 Posted October 4, 2008 Share Posted October 4, 2008 what is wrong with the path "/home/painsb/public_html/lottery/drawnumbers.php" ? Link to comment https://forums.phpfreaks.com/topic/127042-php-cron-job-help/#findComment-657272 Share on other sites More sharing options...
interlog Posted October 7, 2008 Author Share Posted October 7, 2008 That did the trick. Thanks for that! Mark Link to comment https://forums.phpfreaks.com/topic/127042-php-cron-job-help/#findComment-658713 Share on other sites More sharing options...
genericnumber1 Posted October 7, 2008 Share Posted October 7, 2008 That was certainly delayed! Well I'm glad you got it working, not that I did much. Link to comment https://forums.phpfreaks.com/topic/127042-php-cron-job-help/#findComment-658732 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.