Find the Cron php.ini File

Many server configurations use a separate php.ini file for the command line or cron engine than the web server uses. This can sometimes cause issues due to configuration differences.

For more information, see System Cron.

Using SSH

You can identify the php.ini file that the command line and cron engine use by using an SSH session. To do this, you can use your preferred local command line terminal or, if you use cPanel & WHM, cPanel’s Terminal feature.

To do this:

  1. Use one of the following methods to access the command line:

    • Open your preferred local command line terminal and log in to the server that hosts your WHMCS installation using SSH.
      Ideally, you should log in with the same account that your WHMCS installation uses. We recommend that you do not log in as the root user for this, because the root user is not the user that runs the cron job.
    • Log in to the cPanel account that hosts your WHMCS installation and go to Home » Advanced » Terminal.
      For more information, see cPanel’s Documentation.
  2. Run the following command:

    php -i | grep "Loaded Configuration File"

    The system will return the location of files that contain this line. For example:

    Loaded Configuration File => /opt/cpanel/ea-php71/root/etc/php.ini

    In this example, the /opt/cpanel/ea-php56/root/etc/php.ini file executes the php command for this account. This is the file that runs the system cron.

Using the Cron Job

You can also find the php.ini file that the command line and cron engine use by checking the cron engine itself.

To do this, use your preferred method to configure a cron job that runs every minute with a cron command that resembles the following example:

php -i | grep "Loaded Configuration File" > /home/example/public_html/whmcs/crons/phpoutput.txt

After at least one minute has passed, check the phpoutput.txt file in the crons directory. The output in the file will contain the path to the php.ini file.

After viewing the output, make certain to remove the temporary cron job to prevent further runs.

Last modified: October 30, 2024