I get this error after installing Magento 2 and enabling the cronjob. The error appears in the email/logfile of the following cronjob:

/usr/local/bin/php -f /home/craftweb/domains/craftseurope.eu/public_html/bin/magento cron:run

Warning: escapeshellarg() has been disabled for security reasons in /home/craftweb/domains/craftseurope.eu/public_html/vendor/magento/framework/Shell/CommandRenderer.php on line 19

cron:run [--group="..."] [--bootstrap="..."]*

Can I deny this one or is there a fix? I don't know if it now works correctly. Maybe someone can give me those insights.

1 Answer 1


Make your own escapeshellarg:

At the end of CommandRenderer.php file add a function:

public function my_escapeshellarg($input)
    $input = str_replace('\'','\\\'', $input);
    return '\''.$input.'\'';

and substitute the line above with

$arguments = array_map('my_escapeshellarg', $arguments);

Or more your store to another host different than mine

Your Answer

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

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