Jump to content

Cron Command PHP Path Detection - Share Your Experience

Recommended Posts

Hi Testers,

A minor new feature in WHMCS 7.7 is automatic detection of the preferred PHP Binary in the Cron Commands provided throughout the product:

  • Setup > Automation Settings
  • Setup > Support > Support Departments
  • Setup > Support > Escalation Rules


The aim is to help users - particularly in EasyApache Multi-PHP environments - execute the cron.php script using the same PHP configuration used to serve web-pages. Thereby ensuring the daily automation tasks are completed consistently.

During the pre-release testing we want to hear your experience of this feature. Some potential starting points for discussion are:

  • What was the cron job command generated in your installation?
  • When using it, did the daily automation tasks execute successfully?
  • What server environment are you running?

Thanks for your help in the pre-release testing!


Share this post

Link to post
Share on other sites

Our standard WHMCS install process involves:

(1) Having config.php in our whmcs crons directory have a $whmcspath pointing to the account's public_html directory (we keep the crons folder out of public_html)

(2) Placing "php.ini" and ".user.ini" files with "date.timezone=Our/Timezone" in ~/public_html

This is for when we target deployment on a Cloudlinux/cPanel/php-fpm system.

We use a cron command like: "*/5 * * * * /usr/local/bin/ea-php72 -c ~/public_html -q /home/username/path/to/crons/cron.php"

Until we took all of the above measures, we were having a number of issues. PHP version weirdness issues were one of them (due to cron using a different php version), but having the php.ini/.user.ini files with the correct timezone was also important to solving some of our problems. For example, support tickets were displaying an incorrect incorrect timestamp - this was because the PHP pipe script didn't have the same php timezone configuration as the main WHMCS interface.

All of this was incredibly frustrating/time consuming/poorly documented, with lots of conflicting information. We had to do a lot of trial and error before settling on both "~/public_html/php.ini" and "~/public_html/.user.ini" as being the reliable solution. Depending on the specific cPanel PHP configuration, it seems there's are a number of different ways that PHP configuration needs to be provided.

This seems very much in the same spirit as the cron command line stuff, so it might be something you consider looking at as well.

Share this post

Link to post
Share on other sites

Hi @WH user,

This sounds a lot like the problem we are trying to solve with this adjustment to the cron command.

In the command we suggest now (when an EasyApache environment is detected) the binary looks at the file path being executed, walks up the file system looking for a .htaccess or php.ini or user.ini that sets the php handler (that multi-php writes) and uses that.

The limitation in this (as I understand it from speaking with the EA team at cPanel) is that when accessing a file outside the web-root it will fall back to the system default PHP configuration.

We'd be interested to hear if you have success using this cron command compared to the one you've been recommending.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.


Important Information

By using this site, you agree to our Terms of Use & Guidelines