set cron in Codeigniter : Welcome to this tutorial on Codeigniter. In this tutorial, we will learn step by step how to set up cron job in Cpanel. Series of Codeigniter 3.1.11 We start coding below step by step.
set cron in Codeigniter
Step :- 1 First of all we have to download and setup a new Codeigniter 3.1.11
set cron in Codeigniter – After that we have to run in our local server & browser, after running we check that our project is running smoothly
Step :- 2 As we can see that the home page of our project has run successfully, after that now we have to set the route.
$route['send-event'] = 'cronjob/sendevent';
Step :- 3 According to this route, now our URL will be like this which we will first test in our local server & browser
Don’t Miss : Set Cron In Laravel
Step :- 4 We have to create a controller named cronjob in which m method has to be created, we are creating method of this name by the name of sendevent, you can take any name of the method.
Under this method, we will send email so that we can check or find out whether our cron job is running properly or not, we have to call the complete function of sending email in sendevent method or complete code to send email.
By hitting this URL http://your-domain-name.com/test-seo-product/send-event we will check whether our code is running successfully on local server & browser or not our code ran successfully Is
Step :- 5 Now we will make our project live by keeping it in any hosting, after that we have to copy and keep the live URL which we will use in CMD
Step :- 6 Now we have to login cpanel, after login cpanel, we have to type cron job in the search bar at the top, after typing, we will see the icon of cron job in the search result at the bottom of the search bar, we have to cron by clicking on that icon.
You have to open the job page, in this page we will get some options to see in which we have to fill the common setting form step by step.
Step :- 7 First option we get to see 10 common setting time list out of which we have to select Once Per Minute(* * * * *) option for testing as soon as we select any option. Common setting form will be filled automatically, we can also fill it manually
set cron in Codeigniter Options
Minutes – This drop-down menu allows you to select the number of minutes between running the cron job, or the minute each hour you want the cron job to run.
Hour – This drop-down menu allows you to select the number of hours between running a cron job or the hour each day you want the cron job to run at.
Days – This drop-down menu allows you to select the number of days between running the cron job or the day of the month on which you want the cron job to run.
Month – This drop-down menu allows you to select the number of months between running the cron job, or the month of the year in which you want the cron job to run.
Weekend – This drop-down menu allows you to select the day(s) of the week on which you want the cron job to run.
set cron in Codeigniter – In the command input we have to type cmd
Click on the Add New Cron Job button to save the changes.
Note for set cron in Codeigniter:- If you have any further questions, please don’t hesitate to contact our 24/7 Stackoverlode support team.