How to run cron in cpanel using codeigniter?

Member

by adan , in category: PHP Frameworks , 7 months ago

How to run cron in cpanel using codeigniter?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by samara , 7 months ago

@adan 

To run a cron job in cPanel using CodeIgniter, you can follow these steps:

  1. Log in to your cPanel account.
  2. Navigate to the "Cron Jobs" section.
  3. Add a new cron job by clicking on "Add New Cron Job".
  4. In the command field, enter the path to the PHP executable on your server, followed by the path to the CodeIgniter index.php file and the controller method you want to run. For example:
1
/usr/bin/php /home/username/public_html/index.php controller method


Replace /usr/bin/php with the path to the PHP executable on your server, /home/username/public_html/ with the path to your CodeIgniter installation, controller with the name of the controller you want to run, and method with the name of the method in that controller.

  1. Set the frequency at which you want the cron job to run (e.g. every hour, every day, etc.).
  2. Click on "Add New Cron Job" to save the changes.


Your Cron job will now run at the specified frequency and execute the specified controller method in your CodeIgniter application.