Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

samsoft's avatar

Error: "-":2: bad command

i'm currently having challenge adding cron link to my cpanel host on godaddy,

* * * * * php /path/to/local/artisan schedule:run 1>> /dev/null 2>&1

its split Error: "-":2: bad command, any typo mistake or i'm adding a wrong param?

0 likes
4 replies
kocoten1992's avatar

It should be something like this

* * * * * php /var/www/html/myproject/artisan schedule:run 1>> /dev/null 2>&1

Otherwise, you should have change it to

* * * * * php /var/www/html/myproject/artisan schedule:run 1>> /tmp/cronlog 2>&1

and go to /tmp/cronlog to see if something is wrong

samsoft's avatar

Thanks, i finally resolve the issue -d register_argc_argv=On

php -d register_argc_argv=On /path/to/artisan schedule:run 1>> /dev/null 2>&1
daltino's avatar

Hi I tried to implement CRON on godaddy as well using this

php -d register_argc_argv=On /home/www/artisan schedule:run 1>> /dev/null 2>&1

How do I verify this CRON is actually executed or if the exact path to artisan is correct

Please or to participate in this conversation.