Jump to content

Your environment appears to be running a different PHP version


cyben76

Recommended Posts

I've just recently updated to PHP 7.3 from 7.2 and I'm getting  the following warning in System Health Status:

 

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

This is the log for the System Health:

 

WHMCS Health Check
================================================================================

error:
 * The system cron does not appear to have completed successfully within the
   last 24 hours. Check your activity logs or learn more about enabling the cron
   in our documentation.

warning:
 * Your environment appears to be running a different PHP version (7.2.23) for
   the System Cron than the currently loaded PHP version (7.3.11). This may
   cause issues running your System Cron.

notice:
 * Your PHP memory_limit value 1024M meets the recommended value of 128M.
 * 
    - Your environment appears to meet the minimum requirements for Automatic
   Updates. To update, you will need to ensure you have at least 250MB of
   available disk space.
   
 * You are running MariaDB version 10.3.20. This version supports all features
   required for full compatibility with WHMCS.
 * A verified SSL certificate was detected for your site.
 * cURL reports that it does support Secure TLS 1.1 and 1.2
 * cURL reports that it does support SSL
 * You currently have version 7.66.0 of cURL installed. This version uses a
   secure cipher list.
 * Your PHP environment uses a valid timezone.
 * PHP session support is enabled.Session autostart is disabled.The PHP session
   save path /var/cpanel/php/sessions/ea-php73/ is writable. 
 * Your PHP installation has all required functions enabled for WHMCS to
   operate.
 * Your permissions are appropriately restrictive.
 * Your PHP installation has all recommended extensions loaded and enabled
   required by certain modules and addons of WHMCS.
 * Your PHP installation has all extensions loaded and enabled required for
   WHMCS to operate.
 * Your system is setup to not log unnecessary error levels.
 * Your system is not currently set to display errors.
 * Your PHP version 7.3.11 is supported by WHMCS. Your PHP version is actively
   supported by PHP for both bug fix and security releases.
 * Your WHMCS installation is using custom templates which will not be
   overwritten on upgrade.
 * You are using custom paths for all the recommended WHMCS directories.
 * Your SMTP settings are using encryption to ensure that sensitive data in
   email cannot be leaked in transit to your mail transport agent.

debug:
 * Here are the paths for customisable directories in your WHMCS installation:
    - Attachments directory: /home/username/attachments
    - Downloads directory: /home/username/downloads
    - Compiled templates directory: /home/username/templates_c
    - Cron directory: /home/username/crons
    - Admin directory: /home/username/public_html/admin_folder
   

All the cron seems to be running when i check the Activity log but I'm missing the daily WHMCS Cron Job Activity email:

 

1519912872_Screenshot2019-11-20at1_59_00PM.png.ea37424bb120c453b322e7172295c733.png

Link to comment
Share on other sites

Seems like the system cron stops at updating Product Pricing Update,  no errors being logged:

 

WHMCS Automation Task Utility: all
==================================

TSS Cron started
TSS Cron completed Daily Cron Automation Mode

Queuing Tasks
-------------

 Force run any tasks: ignore "in progress" and "is due"
 Task queues ready

Executing Application Queue
---------------------------

  0/30 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░]   0% < 1 sec/< 1 sec 26.0 MiB
 Currency Exchange Rates
  1/30 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░]   3%  1 sec/30 secs 26.0 MiB
 Product Pricing Updates

 

Edited by cyben76
Link to comment
Share on other sites

15 hours ago, zitu4life said:

hello ,   where   I can find   that print   on your previous post    Setup>General   Settings ???

Sorry for the late reply, it's under Setup -> Automation Settings if you are implying the Currency Auto Update Settings
 

If you are talking about the WHMCS Automation Task Utility  you'll need to run the cron using Command line

Edited by cyben76
Link to comment
Share on other sites

Hey Guys,

Update, the PHP version mismatch error I think was caused by cPanel. Previously the cPanel version on the server WHMCS was hosted on was version 84.0.12. The server has since been upgraded to version 84.0.14 and Cron PHP Version Mismatch warning in  System Health Status is no longer seen.

Link to comment
Share on other sites

I had the same issue few years back was due to too many products updating, back then my whmcs was hosted on a shared hosting platform and it was hosted on CloudLinux, hosters did not allow increase in resources. It stalled I think because it took up to much memory and execution time was too long. 

It was all solved when i migrated my whmcs to a VPS,  increased memory limit and execution time. Currently i have php memory limit at 512mb execution time 1200, but still stalled. For now i don't really have the need to "Update Product Pricing" so i disabled it and cron works fine, I'll try see if i can find the root cause, but the server is live so i can't really test much. 

Link to comment
Share on other sites

  • 3 weeks later...
On 11/24/2019 at 7:06 AM, zitu4life said:

it makes more sense. I did not believe since begining that automation currency could cause such issue, that is because I have asked to try to replicated it, because I have faced same issue on my enviroment.

hey zitu4life,

I figured out my issue, many years back I was using reliablesite.net to resell servers. The had hundreds of servers, my mistake during that time was I selected all the servers in their WHMCS addon. Each server had a Configurable Option, moving forward... I decided not to resell their servers as they were located out of my region. So I delete the addon and all the Configurable Options. Their prices were in USD, I was selling in another currency. 

I just realised that when you delete the Config Options it does not delete it in the database, tblproductconfigoptions,  tblproductconfigoptionssub and all the pricing in tblpricing. I just checked yesterday and all of it still there after so many years, eventhough in WHMCS - Setup>Product/Services>Configurable Option they were all deleted. This was causing the slowness when the cron runs to update the product price after currency update.

I don't know what happened, but i just checked yesterday my tables had some issues, i had duplicate entries for all my pricing, meaning 2 in home currency and 2 in USD. I followed this guide to remove all the duplicates: 


After removing all the duplicate and ensuring all the price is correct I proceeded to delete all the config options and price of the config options... Total I had 16092 rows in the pricing table that and about the same number of rows in tblproductconfigoptionssub.
Good thing I used the SQL command to delete all. Please make sure if you need to do the same get the relid of the price from tblproductconfigoptionssub before you delete the rows in tblproductconfigoptionssub

DELETE FROM `tblpricing` WHERE `type` = 'configoptions' AND `relid` BETWEEN X AND XXXXX

After doing all that, i switched on update currency and update product price in Automation settings and the cron ran without any issues.

Edited by cyben76
Link to comment
Share on other sites

  • 3 weeks later...
On 11/23/2019 at 5:17 AM, cyben76 said:

Hey Guys,

Update, the PHP version mismatch error I think was caused by cPanel. Previously the cPanel version on the server WHMCS was hosted on was version 84.0.12. The server has since been upgraded to version 84.0.14 and Cron PHP Version Mismatch warning in  System Health Status is no longer seen.

 

Rounding back to the original question,  although the OP followed up nicely, there was not a definitive answer given on how to solve a Cron PHP Version Mismatch error in WHMCS.

The OP's original problem was clearly stated in the OPs original post:

Your environment appears to be running a different PHP version (7.2.23) for the System Cron than the currently loaded PHP version (7.3.11).

I assume he hides his cron.php outside/behind his public_html root for security purposes?

His error above showed a conflict between what version of PHP WHM was running for system files and what version of PHP CPanel was using to share your scripts across the web.

WHMCS was running under php73 and hos cron.php files was running under php72.

Two things might have happened to fix the OP's original concern:

  • Either the OP recently updated his site's PHP to php73 or the system did for some reason.  Then after WHM/CPanel updated to its latest version, possibly through the nightly WHM cronjob of /scripts/upcp, the PHP difference was corrected.
  • The OP includes a path to his PHP install within the cron job command, very common, and the path reflected one to php72. Possibly he corrected the path tp php73 when trying to diagnose the concern? 

For anyone else who needs further help with the Cron PHP Version Mismatch error, there is good documentation on how to fix this issue here at WHMCS:

https://help.whmcs.com/m/automation/l/969680-identifying-the-php-ini-used-for-in-command-line-cron-engine

 

 

 

Edited by GamerNinja
Link to comment
Share on other sites

As stated the issue was caused by cPanel/WHM, prior to the issue I mentioned I had issues with cPanel/WHM 84.1.10 and highlighted it to cPanel Support thus the fix 84.0.12 was released but soon after updating to 84.0.12 the PHP version mismatch error happened. No changes were made to the cron path and so on as you mentioned. By the way, placing the cron outside of the home folder is one of the security steps mentioned in https://docs.whmcs.com/Further_Security_Steps

You can view the cPanel/WHM changelog of the timeline of the changes madehttps://documentation.cpanel.net/display/CL/84+Change+Log

Sorry for the above I really don't understand why the quote came out so weird.. LoL

Link to comment
Share on other sites

  • 9 months later...
On 6/01/2020 at 6:30 PM, GamerNinja said:

 

R

  • Either the OP recently updated his site's PHP to php73 or the system did for some reason.  Then after WHM/CPanel updated to its latest version, possibly through the nightly WHM cronjob of /scripts/upcp, the PHP difference was corrected.
  • The OP includes a path to his PHP install within the cron job command, very common, and the path reflected one to php72. Possibly he corrected the path tp php73 when trying to diagnose the concern? 

For anyone else who needs further help with the Cron PHP Version Mismatch error, there is good documentation on how to fix this issue here at WHMCS:

https://help.whmcs.com/m/automation/l/969680-identifying-the-php-ini-used-for-in-command-line-cron-engine

 

Thanks for the info. If anyone is getting this error, you can probably also just make a very likely educated guess.  Look in cPanel for Cron jobs that reference a php version.  /opt/cpanel/ea-php73/root/usr/bin/php   like this. And if your PHP version has been updated or is different to this version, for example 7.4 now in place of 7.3. Just update the 3 to a 4 in that URL and you are good to go. 

 

On 6/01/2020 at 6:30 PM, GamerNinja said:

 

 

Link to comment
Share on other sites

  • 3 years later...

This issue persists. I switched from php7.4 to php8.1 with WHMCS v8.8. Warning is still showing when I fire the cron with version php8.1.

ie. 

*/5 * * * * /usr/bin/php8.1 -q /var/www/html/public/clients/crons/cron.php

When in fact on the same warning page it's giving me this:

PHP Version
Your PHP version 8.1.27 is supported by WHMCS.

The PHP 8.1 branch no longer receives regular bug fixes and will only receive critical security updates until it reaches its end of life. Please see our documentation for more information.

I have no idea where it's picking up the environment issue that it's php7.4 when it's actually using php8.2. Anyone know?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated