Efficient Magento 1 cron on CloudLinux systems

It's no secret that CloudLinux, with its CageFS and PHP selectors, cause problems running the default Magento cron on cPanel servers. But it doesn't have to be this way, and in fact, we can flip this on its head to make the Magento cron as fast as it's ever been with some simple tweaking. Let's get going.

First, we want to edit the cronjob in cPanel:

  • Login to your cPanel account
  • Scroll to Advanced and click Cron Jobs
  • Now find your Magento cron and click the Edit button.

In the command box, paste the following, though make sure you replace username for your real cPanel username, correcting the path where necessary:

/bin/sh /home/username/public_html/cron.sh

Once you've pasted, click Save button.

Next, we want to edit the cron.sh file to make a minor change. Instead of relying on the shell's recommended location of PHP, which causes problems with the PHP selector and cPanel's default PHP version, we want to hard-code the PHP path and also use lsphp instead of raw PHP, which brings extra performance:>

  • Go back to the main cPanel interface
  • Scroll to Files
  • Now click the File Manager button

Once you're in File Manager:

  • Change to public_html and locate the cron.sh file (or if you've installed Magento in a subdirectory please locate it in there)
  • Double-click cron.sh to open the editor
  • Now, find the line that begins 'PHP_BIN'
  • Replace the line with the following

And that's us done. We've successfully mitigated the PHP version issues and switched to the faster lsphp for processing.

  • magento, magento 1, magento 1.7, magento 1.8, magento 1.9, magento stable, cron, lsphp, cpanel, cloudlinux, broken, slow, version, php, error
  • 2 Users Found This Useful
Was this answer helpful?

Related Articles

Exception: Notice: Use of undefined constant ICONV_IMPL

Exception: Notice: Use of undefined constant ICONV_IMPLAre you experiencing this error when...

How to re-index from PHP command line using SSH

As your Magento store grows in size with more products, orders and customers, you may experience...

How to upgrade Magento 1 using SSH CLI

This is an easy and quick upgrade guide for updating Magento 1.7, 1.8 and 1.9 to Magento 1.9.x....

How to Install RabbitMQ Server on CentOS 7

RabbitMQ is an open-source message broker, which can be used to greatly enhance the speed of...