problem cronjob cyberpanel with whmcs

I currently use cyberpanel. in it I installed WHMCS and for my account I set it with php 7.2

but i get a message like this on whmcs:

Cron PHP Version Mismatch
Your environment appears to be running a different PHP version (7.1.31) for the System Cron than the currently loaded PHP version (7.2.22). This may cause issues running your System Cron.

so I get cron error emails continuously … for example like this:
PHP Notice: ob_end_flush (): failed to delete and flush buffer. No buffer to delete or flush in / home / xxxxxxx.com/public_html/modules/gateways/billingotomatis/cron-bankmandiri.php on line 5
PHP Notice: Undefined offset: 1 in / home / xxxxxxx.com/public_html/modules/gateways/billingotomatis/cron-bankmandiri.php on line 7

I tried to ask this to WHMCS, they would still answer like this:

Your web server and shell environment do not share configurations, so it is quite common for the default PHP system in shell to be different than the one you’ve specified for your cron.

Your server admin or webhost will be able to assist with adjusting your cron command to use the same PHP version as your website.

Please help the cyberpanel team to resolve this problem.

I updated to the latest version of cyberpanel, I saw this error related to cash. For example, for me it does not work logging for both client and admin! try old version !

@hosteko @hostingfuze I am using WHMCS on CP without any issue from last more than 4 month. Everything working perfectly.

Please share your WHMCS version and PHP version.

Please check with the module - billingotomatis since I am not using that. Remove/disable this and try.

I use whmcs 7.8.1
actually happened … like this. domain account for whmcs, I set it to 7.2. but it seems that cronjob runs with php 7.1 according to cyberpanel system standards.

Oh, In my case I am using PHP 7.1 so maybe this issue has not occurred to me.

I still have the same problem. even though I changed php to 7.1 :frowning:

this is easily fixed via a symlink or using the full path to the PHP version in the cron.

If using the full path:
/usr/local/lsws/lsphp72/bin/php

SHELL="/bin/bash"
*/5 * * * * /usr/local/lsws/lsphp72/bin/php -q /home/example.com/public_html/crons/cron.php >/dev/null 2>&1

If you have the main binary “/usr/bin/php” symlinked to the default version you want it would look like this.
*/5 * * * * /usr/bin/php -q /home/example.com/public_html/crons/pop.php >/dev/null 2>&1

root@ols:~# ls -l /usr/bin/php
-rwxr-xr-x 1 root root 12517872 Aug 28 22:57 /usr/bin/php

current PHP version
root@ols:~# /usr/bin/php -v
PHP 7.1.31-2+bionic (cli) (built: Aug 7 2019 14:11:34) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.32-1+bionic, Copyright (c) 1999-2018, by Zend Technologies

confirm full path to the binary I’m using php 7.3 but works same for the others.
root@ols:~# stat /usr/local/lsws/lsphp73/bin/php
File: /usr/local/lsws/lsphp73/bin/php
Size: 14916080 Blocks: 29136 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 2097938 Links: 1
Access: (0755/-rwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2019-09-06 22:34:28.000000000 -0400
Modify: 2019-08-29 04:09:05.000000000 -0400
Change: 2019-09-06 22:34:48.024644624 -0400
Birth: -

remove the file so we can create the symlink
root@ols:~# rm /usr/bin/php

ln -s source_file myfile
ln -s /usr/local/lsws/lsphp73/bin/php /usr/bin/php

symlink
root@ols:~# ln -s /usr/local/lsws/lsphp73/bin/php /usr/bin/php

Test
root@ols:~# /usr/bin/php -v
PHP 7.3.9-1+bionic (cli) (built: Aug 29 2019 08:09:05) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.9, Copyright (c) 1998-2018 Zend Technologies
with the ionCube PHP Loader + ionCube24 v10.3.7, Copyright (c) 2002-2019, by ionCube Ltd.
with Zend OPcache v7.3.9-1+bionic, Copyright (c) 1999-2018, by Zend Technologies

Can see how it looks here
root@ols:~# ls -l /usr/bin/php
lrwxrwxrwx 1 root root 31 Oct 8 13:45 /usr/bin/php → /usr/local/lsws/lsphp73/bin/php
root@ols:~#

I hope that helps. I went through this same issue a few months back when I switched to Cyberpanel too.

problem solved, thanks you for help

my pleasure happy to help :slight_smile: