I have set a cron job using cpanel but I have found one issue. My another cron is running as expected and it is firing a testing mail every 5 minutes. I have latest version of magento 1.7.0.2 and I have changed nothing from cron.php file that was provided with magento installation.
When I try to run /usr/bin/php /full/path/to/htdocs/cron.php
from terminal, I am getting below error.
<b>Parse error,</b>: syntax error, unexpected T_OBJECT_OPERATOR in <b>/full/path/to/htdocs/cron.php</b> on line <b>39</b><br/>
I know that there is some issue with mage autoloader but cron.php is untouched and it seems like mage is not being loading while running cron.php through command line.
Please help me. It is really frustrating to me.
BTW, here is the cron.php file.
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
* @package Mage
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
require 'app/Mage.php';
if (!Mage::isInstalled()) {
echo "Application is not installed yet, please complete install wizard first.";
exit;
}
// Only for urls
// Don't remove this
$_SERVER['SCRIPT_NAME'] = str_replace(basename(__FILE__), 'index.php', $_SERVER['SCRIPT_NAME']);
$_SERVER['SCRIPT_FILENAME'] = str_replace(basename(__FILE__), 'index.php', $_SERVER['SCRIPT_FILENAME']);
Mage::app('admin')->setUseSessionInUrl(false);
umask(0);
try {
Mage::getConfig()->init()->loadEventObservers('crontab');
Mage::app()->addEventArea('crontab');
Mage::dispatchEvent('default');
} catch (Exception $e) {
Mage::printException($e);
}
On line 39, Mage::app('admin')->setUseSessionInUrl(false);
. TIA.
Regards