Cronjob Reference an account's default ea-php

David Colter

Active Member
Jun 30, 2016
40
10
8
USA
cPanel Access Level
Root Administrator
Is it possible to use an account's WHM assigned ea-php version in the command line, instead of it being hard coded? Or, maybe to use the System PHP version? (Account Cpanel - PHP Selector does not allow a choice.)

For example, by emulating this:
Code:
/usr/local/bin/ea-php72 /home/account/path to/file.php
with some 'php' that uses the account's assigned version.

What I want to accomplish is having all crons jobs change PHP version as the account's version is changed.

On this Cpanel reference page, I found the php.conf file, containing:
Code:
# tail -20 /etc/cpanel/ea4/php.conf
---
default: ea-php72
ea-php72: suphp
ea-php73: suphp
David
 
Last edited:

David Colter

Active Member
Jun 30, 2016
40
10
8
USA
cPanel Access Level
Root Administrator
Its real easy.
Code:
cd /home/account/path to/ && php -q ./file.php
Since the default version of the system is ea-php72, the file is executed with that.

Incidentally, you can still use environmental variables and arguments like so:
Code:
cd /home/account/path to/ && ENV=var php -q ./file.php argument1 “argument 2”
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,237
463
Hello David,

Here's the part of the document relevant to that question:

The system default php.conf file
The system uses the /etc/cpanel/ea4/php.conf file to determine the system's default PHP version and the PHP handler that each PHP version uses.

If a PHP file's PHP version is not explicitly set, the system uses the default entry in the /etc/cpanel/ea4/php.conf file to determine which version of PHP to use.

Set the system's default PHP version and an individual domain's PHP version in WHM's MultiPHP Manager interface (WHM >> Home >> Software >> MultiPHP Manager). You can also set the system's default PHP version with the /usr/local/cpanel/bin/rebuild_phpconf script. For more information, read our PHP documentation.
Thank you.