0

My update cron job is failing. The cron entry is:

* * * * * /usr/bin/php -c /etc/php5/apache2/php.ini /var/www/magento2/update/cron.php >> /var/www/magento2/var/log/update.cron.log

and the error is:

Parse error: syntax error, unexpected '.', expecting ')' in /var/www/magento2/update/app/code/Magento/Update/UpdateLoggerFactory.php on line 31

Line 31 from UpdateLoggerFactory.php:

 $logFile = MAGENTO_BP . '/var/log/update.log',

belonging to the block:

public function __construct(
    $logFile = MAGENTO_BP . '/var/log/update.log',
    $channelName = 'update-cron'
) {

I am using Ubuntu Server 14.04, php 5.5.9, Apache 2.4.7

Any ideas?

0

PHP 5.6 introduces concatenation in function argument declarations. See example on 5.5 vs on 5.6.

I'm currently failing to find a reference for this change in the PHP documentation, but will edit when I do.

Which version of M2 are you using? I can't find that file on the GitHub repository. Possibly you're using an old M2 version, and this is the new file?

If you do find the source file, the best way to fix it would be to submit a pull request to them to make it backwards compatible, i.e.:

public function __construct(
    $logFile = null,
    $channelName = 'update-cron'
) {
    if (is_null($logFile)) {
        $logFile = MAGENTO_BP . '/var/log/update.log';
    }
  • I installed using Composer, it is 2.0.7 – John F. May 31 '16 at 13:03

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.