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

roywealth's avatar

Bad command errors in crontab file, can't install

Hello, Am trying to set my cronjob to run but after adding this cron command

          • php /home/bitcwlbc/public_html/myproject/artisan schedule:run >> /dev/null 2>&1

i keep getting error message saying

"_";2: Bad command errors in crontab file, can't install

what could be the problem. my kemel.php file is

0 likes
14 replies
Sinnbeck's avatar

Are you sure you are using * ? Can you post the string as code using ``` on the line before it?

* * * * * php /home/bitcwlbc/public_html/myproject/artisan schedule:run >> /dev/null 2>&1
roywealth's avatar

Yes..

"* * * * * php /home/bitcwlbc/public_html/myproject/artisan schedule:run >> /dev/null 2>&1"

not sure why system keep changing here.

roywealth's avatar

this is exactly how my code looks like without " . i only use it because it keep changing the * when i try to post here

Sinnbeck's avatar

My bet is that they set the * * * * * already. Just add this

php /home/bitcwlbc/public_html/myproject/artisan schedule:run >> /dev/null 2>&1
1 like
roywealth's avatar

Commad added with no error will see if that works as i need 24 hours to confirm.

roywealth's avatar

Not working friend, i run the cronjob manuelly and it works. Am not sure if its my hosting that is casuing this as they did not allow me to run the cronjob per mins which how the scripts is configured to work. I set to per 5 mins, could that be the reason why its not working?

Also is there anyway otherway i can set the cronjob with using crontab?

Sinnbeck's avatar

Yes make sure that it runs every minute. This is very vital

roywealth's avatar

Anyway i can set cronjob to run automatically through commandline without having to manually run?

Sinnbeck's avatar

If you want to set up a cronjob using command line you can run crontab -e

Paste the full code in there

Please or to participate in this conversation.