Efficient Magento 1 cron on CloudLinux systems Print

  • magento, magento 1, magento 1.7, magento 1.8, magento 1.9, magento stable, cron, lsphp, cpanel, cloudlinux, broken, slow, version, php, error
  • 2

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
PHP_BIN=/opt/cpanel/ea-php56/root/usr/bin/lsphp



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


Was this answer helpful?

« Back