Cron Management

Hi
How to setup cron to whmcs

Just like that 7 - Cron Jobs - 04 - Websites - CyberPanel Community

this issue is due to the ioncube loader with cyberpanel 7.2 7.3 etc all being outdated
You should still install it for the PHP version in use and then use that as a template to enable it.

How i fixed it.

You may find this helpful for the getting ioncube to work for php cli cronjobs for whmcs

  1. Put an phpinfo.php page in the directory of the site. go to the link

  2. ctrl+f look for “extension_dir”

  3. In my case it was
    For PHp 7.2
    /usr/local/lsws/lsphp72/lib/php/20170718/
    for PHP 7.3
    /usr/local/lsws/lsphp73/lib/php/20180731/

  4. Rename the original ioncube.so
    cd /usr/local/lsws/lsphp72/lib/php/20170718/
    mv ioncube.so ioncube.so.bak

cd /usr/local/lsws/lsphp73/lib/php/20180731/
mv ioncube.so ioncube.so.bak

  1. then upload the new copy of these loaders for those versions from Loader Download - PHP Encoder, protection, installer and performance tools from ionCube

cp /home/username/ioncube_loader_lin_7.2.so /usr/local/lsws/lsphp72/lib/php/20170718/ioncube.so

If your system default is php 7.2 there will be a cli for this version that needs the ioncube enabled as well so cronjobs will work.

use nano/vi etc to edit and append this to the end.
nano /etc/php/7.2/cli/php.ini
zend_extension = /usr/local/lsws/lsphp72/lib/php/20170718/ioncube.s
restart litespeed/openlitespeed

Should work for both CLI and website PHP

Just an update in case your getting an error in whmcs php cli cron for the database connection issue.

Critical Error

Could not connect to the database.

using an absolute path to the same version as the website is using with the -f vs -q works for me.
so instead of this
php -q /home/website.com/public_html/crons/cron.php

Using this:
/usr/local/lsws/lsphp73/bin/php -f /home/website.com/public_html/crons/cron.php

After checking to see crons executed normally like im used to seeing on cPanel.

If you notice it does not show the proper cron after added via webinterface using crontab -e to manually specify it should correct the issue.

I am on the latest release of OpenLiteSpeed and LSPHP and I am configured to PHP 7.3 and I have yet to see the issues you described with any of my cron jobs.

Well, thanks for the insight. I thought that was odd. I realized after more digging it was a symlink and permissions issue on this.

What wasn’t working.
devwhat@ols:~$ stat /usr/bin/php
File: /usr/bin/php → /etc/alternatives/php

The one that was working.
devwhat@ols:~$ stat /usr/local/lsws/lsphp73/bin/php
File: /usr/local/lsws/lsphp73/bin/php

Unlinked
root@ols:~# rm /usr/bin/php

Made this the global default.
root@ols:~# cp /usr/local/lsws/lsphp73/bin/php /usr/bin/php

Working beautifully now.

Type your comment> @whattheserver said:

Well, thanks for the insight. I thought that was odd. I realized after more digging it was a symlink and permissions issue on this.

What wasn’t working.
devwhat@ols:~$ stat /usr/bin/php
File: /usr/bin/php → /etc/alternatives/php

The one that was working.
devwhat@ols:~$ stat /usr/local/lsws/lsphp73/bin/php
File: /usr/local/lsws/lsphp73/bin/php

Unlinked
root@ols:~# rm /usr/bin/php

Made this the global default.
root@ols:~# cp /usr/local/lsws/lsphp73/bin/php /usr/bin/php

Working beautifully now.

Works perfectly.