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 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.

 * Magento
 * 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 license@magentocommerce.com so we can send you a copy immediately.
 * 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.";

// 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']);



try {
} catch (Exception $e) {

On line 39, Mage::app('admin')->setUseSessionInUrl(false);. TIA.


<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/>

BTW, here is the cron.php file.

That seems — unlikely. I saved the source of the include cron.php file to a file on my system, and ran the basic PHP lint on it

php -l /path/to/cron.php
No syntax errors detected in /path/to/cron.php

The error you're getting is a Parse Error. This means no PHP executes, because the code syntax is completely wrong.

I'd check

  1. That your version of PHP isn't some ancient PHP 4 version ($ php -v)
  2. That the version of cron.php you're running for the error is the same version of cron.php you're looking at to debug.
  • Thanks for your answer. I have found few minutes ago that running cron using /usr/bin/php is referring to some previous version 4.4.9 and I changed to /usr/bin/php5 and now it is referring to php 5.2.17. Last two statements from your answers are correct. Sep 12 '13 at 22:10
  • @Kamal Ha! I almost didn't include that bit about PHP 4 because it seemed too ludicrous to be true — glad you tracked it down!
    – Alan Storm
    Sep 12 '13 at 23:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.