I am hosting my magento 2 shop at all-inkl and unfortunately I can only use a "cgi bridge" to call the cron.php via a web cron job.

I have built that bridge which looks like that:

exec("/bin/bash cron.php  2>&1", $out, $result);
echo "Returncode: " .$result ."<br>";
echo "Script:" ."<br>";
echo "<pre>"; print_r($out);

my cron.php looks like that:

* * * * * /usr/bin/php /www/htdocs/USER/magento2/bin/magento cron:run | grep -v Ran jobs by schedule >> /www/htdocs/USER/magento2/var/log/magento.cron.log
* * * * * /usr/bin/php /www/htdocs/USER/magento2/update/cron.php >> /www/htdocs/USER/magento2/var/log/update.cron.log
* * * * * /usr/bin/php /www/htdocs/USER/magento2/bin/magento setup:cron:run >> /www/htdocs/USER/magento2/var/log/setup.cron.log

But if I open the bridge file via my browser, I get this error:

Returncode: 127 Script: Array ( [0] => cron.php: line 2: /bin/grep: Permission denied

[1] => cron.php: line 2: CHANGELOG.md: command not found
[2] => cron.php: line 3: CHANGELOG.md: command not found
[3] => cron.php: line 4: CHANGELOG.md: command not found 


I have no idea how to get those cron jobs running.

1 Answer 1


Magento 2 cron are run via cli, you can configure the cron as below.

Note: Update paths as your current system.

    $output = exec("/opt/lampp/bin/php -d memory_limit=2G  /opt/lampp/htdocs/magento/2.2.4/bin/magento cron:run");
    echo "<pre>"; var_dump($output);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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