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

Slak's avatar
Level 2

Setting up CRON JOB in cPanel

Hi guys,

I'm having a problem adjusting all the parameters in cPanel's cron jobs. I have a job inside a app/Console/Commands/MyJob.php, a class that extends Command class and has implemented handle function for firing some emailing functionality.

I'm trying to figure out how to adjust a path (I'm quite certain this is an issue), when looking at documentation (https://laravel.com/docs/5.1/artisan) and reading through stackoverflow it seems that I need to run a artisan command. What is not clear is the "path/to/artisan". What is this path??

What I've tried so far:

  • /usr/bin/php -q home/username/public_html/mysite.si/project/artisan command:sendEmails schedule:run 1>> /dev/null 2>&1
  • cd /home/username/public_html/ && /usr/local/bin/php artisan sendEmails

I'm kinda shooting in the dark here so any help would be appreciated.

Sincerely, Jan

0 likes
3 replies
dawiyo's avatar

If you have SSH access, cd into your Laravel directory and use the pwd command to find the current path. Also, in the left hand column of cPanel, it lists the "Home Directory". That is the main directory before public_html.

I use this in cPanel:

php -d register_argc_argv=On /home/dawiyo/laravel-site-dir/artisan schedule:run > /dev/null 2>&1
2 likes
Slak's avatar
Level 2

@dawiyo, I don't have ssh, its a shared hosting and provider does not allow it.

I will try your solution, in the meantime I solved my problem by exposing command via direct url and calling "wget command_url".

fixThat's avatar

Hey @Slak, I am facing a similar problem here. Could you please help me by giving out your exact cron command?!

Please or to participate in this conversation.