Skip links
🔧
Need help with installation?
Send an email to [email protected] to get a quote.

How to Configure Cron Jobs on cPanel

Table of Contents

Configuring Laravel cron jobs in cPanel is a fairly simple task. In this post you will see how to perform such configuration and lose the fear of scheduled system tasks, which Laravel already makes quite simple by itself.

Getting started with configuration

The first step is to log in to your cPanel account via SSH. Once there, you must verify that you have the proper access to execute the schedule:run command from Laravel.

				
					[user@server]$ php artisan schedule:run
No scheduled commands are ready to run.
				
			

If everything has gone well, that is, you can run the command without problems, we can verify where the PHP binary comes from as follows:

				
					[user@server]$ whereis php
php: /usr/bin/php /usr/lib64/php /usr/local/bin/php
				
			

That is, we can run the complete command like this

				
					/usr/local/bin/php artisan schedule:run
				
			

Another thing you must have at hand is the directory where the artisan file is located. In my case:

				
					/home/cpanel-user/laravel-app/artisan
				
			

Finally, we must log in to our cpanel account, look for the cron jobs option and create an entry that runs every minute like this:

The command you must enter based on what we have obtained previously would be the following:

				
					/usr/local/bin/php /home/cpanel-user/laravel-app/artisan schedule:run >> /dev/null 2>&1