简体   繁体   中英

ZF3 error when cron runs

I've got route:

'console' => [
    'router' => [
        'routes' => [
            'cronroute' => [
                'options' => [
                    'route' => 'action',
                    'defaults' => [
                        'controller' => Controller\ConsoleController::class,
                        'action' => 'action',
                    ],
                ],
            ],
        ]
    ],
],

and when I run it in console:

php /Applications/www/project/public/index.php action

everything is ok, no errors

But when I try to add this script to crontab:

* * * * * php /Applications/www/project/public/index.php action >> /Applications/www/log/script_output.log 2>&1

I get errors in the log:

Parse error: parse error in /Applications/www/project/vendor/phpunit/phpunit/src/Framework/TestCase.php on line 856

I don't use phpunit anywhere in my code.

My webserver uses php 7.0, command also 7.0, but cron 5.6. Latest version of PhpUnit required >5.6, that why I get error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM