Cron Error on Line 240 from Mage/Core/Helper/Abstract.php

ce-1.9.1.0cronPHP

I will start by saying that I have not overwritten any core files (except the one noted below), and have disabled my theme. I'm am currently running on stock Magento 1.9.1. My website is not live, and I am accessing it via a modified hosts file to redirect my computer.

One thing that does concern me is that the server I'm installed on is running PHP version 5.2.17 natively. So in order to install Magento 1.9.1 I used PHP variable manager from Cpanel to set each of the top folders (app, downloader, media, skin, var, etc) .httaccess file to PHP 5.5. Everything has been working fine until I went to run cron.

I have left the cron settings in the back of magento as default, and have set cron in cpanel to run every 5 minutes.

My first issue was that cron would not launch. After looking online I saw that a known bug required

$isShellDisabled = true;

to be entered on line 49 in cron.php.I did this and cron started running. However it does not complete, and gives this error message.

Parse error: syntax error, unexpected T_FUNCTION in /home/*******/public_html/app/code/core/Mage/Core/Helper/Abstract.php on line 240

After looking online I saw that some say this is caused by wrong PHP version; however I also saw how some said the lines of code causing the error could be rewritten in a different way. I tried the code rewrite; however I then began getting multiple errors in lib/Pelago/Emogrifier.php. The errors were because of this "/" throughout the code. See below examples of the type of code syntax that was causing the errors.

throw new \InvalidArgumentException

throw new \BadMethodCallException

$xpath = new \DOMXPath($xmlDocument);

I also got several errors of the same style as the one from mage/core/helper/Abstract.php.

Once I saw how many errors I was getting in this file, I realized that rewriting code was not the answer, and something must be setup wrong.

The only thing I can think of is that cron isn't functioning without the website being live? Or I'm having issues with my version of PHP? However my products, menus, transactional emails, ups shipping estimates, everything else is working.

Any ideas to point me in the right direction would be greatly appreciated!

Best Answer

Solved: It was the PHP version of Cron Jobs.

The PHP version was set correctly for the site which is why it was working; however Cron Jobs was running at server native PHP 5.2 which is why I was getting the errors only when running Cron.

Changed Cron command:

php /home/mydomainname/public_html/cron.php
to
php55 /home/mydomainname/public_html/cron.php