Cannot get PHP 7.2 in shell

SoftDux

Well-Known Member
May 27, 2006
1,024
5
168
Johannesburg, South Africa
cPanel Access Level
Root Administrator
Please help.

I use WHMCS, which is encypted, and thus most of the 3rd party plugins are encrypted with Ioncube as well. Ioncube is very fussy about which version of PHP is being used and as a result this one script doesn't run at all.


In WHM > MultiPHP Manager I have PHP 7.2 (ea-php72) as system default. On the same page, I have PHP 7.2 selected for this domain.

Yet, when I login to console with this user, PHP 7.0.33 is the default:

[email protected]:[crons]$ php -v
ea-php-cli Copyright 2017 cPanel, Inc.
PHP 7.0.33 (cli) (built: Feb 10 2019 12:54:41) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v10.3.2, Copyright (c) 2002-2018, by ionCube Ltd.
with Zend OPcache v7.0.33, Copyright (c) 1999-2017, by Zend Technologies
with SourceGuardian v11.2, Copyright (c) 2000-2018, by SourceGuardian Ltd.
[email protected]:[crons]$ which php
/usr/local/bin/php

[email protected]:[crons]$ /usr/local/bin/ea-php70 -v
PHP 7.0.33 (cli) (built: Feb 10 2019 17:39:23) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v10.2.4, Copyright (c) 2002-2018, by ionCube Ltd.
with Zend OPcache v7.0.33, Copyright (c) 1999-2017, by Zend Technologies
[email protected]:[crons]$ /usr/local/bin/ea-php71 -v
PHP 7.1.26 (cli) (built: Feb 10 2019 17:54:56) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v10.2.4, Copyright (c) 2002-2018, by ionCube Ltd.
with Zend OPcache v7.1.26, Copyright (c) 1999-2018, by Zend Technologies
[email protected]:[crons]$ /usr/local/bin/ea-php72 -v
PHP 7.0.33 (cli) (built: Feb 10 2019 12:54:41) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v10.3.2, Copyright (c) 2002-2018, by ionCube Ltd.
with Zend OPcache v7.0.33, Copyright (c) 1999-2017, by Zend Technologies
with SourceGuardian v11.2, Copyright (c) 2000-2018, by SourceGuardian Ltd.


How do I fix this?
 

sparek-3

Well-Known Member
Aug 10, 2002
1,929
180
343
cPanel Access Level
Root Administrator
Try

/opt/cpanel/ea-php72/root/usr/bin/php -v

although, I suspect that something else is going on, that may need to be addressed some where.
 

SoftDux

Well-Known Member
May 27, 2006
1,024
5
168
Johannesburg, South Africa
cPanel Access Level
Root Administrator
Try

/opt/cpanel/ea-php72/root/usr/bin/php -v

although, I suspect that something else is going on, that may need to be addressed some where.

as root it gives the correct PHP version:

[email protected]:[~]$ /opt/cpanel/ea-php72/root/usr/bin/php -v
PHP 7.2.14 (cli) (built: Feb 10 2019 18:20:08) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24. com (unconfigured) v10.2.4, Copyright (c) 2002-2018, by ionCube Ltd.

But as the user not:

[email protected]:[~]$ su - xxx
Last login: Wed Mar 6 21:37:10 SAST 2019 on pts/0
09:04:21 up 1 day, 12:22, 0 users, load average: 0.68, 1.06, 0.98

[email protected]:[~]$ /opt/cpanel/ea-php72/root/usr/bin/php -v
PHP 7.0.33 (cli) (built: Feb 10 2019 12:54:41) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24. com (unconfigured) v10.3.2, Copyright (c) 2002-2018, by ionCube Ltd.
with Zend OPcache v7.0.33, Copyright (c) 1999-2017, by Zend Technologies
with SourceGuardian v11.2, Copyright (c) 2000-2018, by SourceGuardian Ltd.
 

SoftDux

Well-Known Member
May 27, 2006
1,024
5
168
Johannesburg, South Africa
cPanel Access Level
Root Administrator
Hi @SoftDux

What displays for the PHP version when you look use a phpinfo page?
When I run a PHP script with the following code from a web browser it shows PHP 7.2.14
Code:
<?PHP
phpinfo();
?>
[email protected] ~ $ lynx --dump http://xxx.xxx.co.za/phpinfo.php | grep 'PHP Version'
PHP Version 7.2.14
PHP Version 7.2.14
[email protected] ~ $ lynx --dump http://xxx.xxx.co.za/phpinfo.php | grep 'extension version'
php extension version 7.2.14

But the same script, run from the command line shows PHP 7.0.33:

[email protected]:[~]$ php -q www/phpinfo.php | grep version
timelib version => 2016.02
GMP version => 6.0.0
iconv library version => 2.17
imagick module version => 3.4.3
Imagick compiled with ImageMagick version => ImageMagick 6.9.4-10 Q16 x86_64 2017-05-23 http://www.imagemagick.or g
Imagick using ImageMagick library version => ImageMagick 6.9.4-10 Q16 x86_64 2017-05-23 http://www.imagemagick.or g
imagick.skip_version_check => 0 => 0
json version => 1.4.0
libmbfl version => 1.3.2
oniguruma version => 5.9.6
mbstring extension makes use of "streamable kanji code filter and converter", which is distributed under the GNU Lesser General Public License version 2.1.
Multibyte regex (oniguruma) version => 5.9.6
libmemcached version => 1.0.18
Client API library version => 10.2.22
Client API header version => 10.2.19-MariaDB
Client API version => 10.2.22
RAR EXT version => 4.0.3
UnRAR version => 4.20 patch1 2012-12-16
UnRAR API version => 5 extension 1
SQLite3 module version => 7.0.33
core library version => xmlrpc-epi v. 0.51
php extension version => 7.0.33
Zip version => 1.13.5
Libzip version => 1.3.2

[email protected]:[~]$ php -q www/phpinfo.php | grep 'PHP Version'
PHP Version => 7.0.33
PHP Version => 7.0.33
 

SoftDux

Well-Known Member
May 27, 2006
1,024
5
168
Johannesburg, South Africa
cPanel Access Level
Root Administrator
What does

ls -al /opt/cpanel/ea-php72/root/usr/bin/php /usr/local/bin/ea-php72

show?
as root:
[email protected]:[~]$ ls -al /opt/cpanel/ea-php72/root/usr/bin/php /usr/local/bin/ea-php72
-rwxr-xr-x 1 root root 4822256 Feb 11 01:23 /opt/cpanel/ea-php72/root/usr/bin/php
lrwxrwxrwx 1 root root 37 Feb 19 22:06 /usr/local/bin/ea-php72 -> /opt/cpanel/ea-php72/root/usr/bin/php
as user:

[email protected]:[~]$ su - xxx
Last login: Thu Mar 7 09:04:21 SAST 2019 on pts/0


13:42:07 up 2 days, 16:59, 0 users, load average: 0.77, 0.96, 1.00

[email protected]:[~]$
[email protected]:[~]$ ls -al /opt/cpanel/ea-php72/root/usr/bin/php /usr/local/bin/ea-php72
lrwxrwxrwx 1 root root 27 Mar 8 12:24 /opt/cpanel/ea-php72/root/usr/bin/php -> /etc/cl.selector/ea-php-cli
lrwxrwxrwx 1 root root 37 Feb 12 2018 /usr/local/bin/ea-php72 -> /opt/cpanel/ea-php72/root/usr/bin/php
 

sparek-3

Well-Known Member
Aug 10, 2002
1,929
180
343
cPanel Access Level
Root Administrator
You're mixing and matching EasyApache PHP and CloudLinux PHP.

The PHP version you are seeing in the user's shell is controlled by CloudLinux's voodoo with their CageFS.
 
  • Like
Reactions: cPanelLauren

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,241
363
Hello @SoftDux,

The system uses the user's configured PHP path to determine which PHP version it calls. Can you let us know the output from the command below when you run the PHP version check as the user?

Code:
pwd
If it doesn't show /home/$username/public_html, browse to the user's public_html directory and see if the issue persists. EX:

Code:
cd /home/$username/public_html
php -v
If you're using CloudLinux, can you share more information about how you've defined the default PHP version and the account's PHP version?

Thank you.
 

SoftDux

Well-Known Member
May 27, 2006
1,024
5
168
Johannesburg, South Africa
cPanel Access Level
Root Administrator
Hello @SoftDux,

The system uses the user's configured PHP path to determine which PHP version it calls. Can you let us know the output from the command below when you run the PHP version check as the user?

Code:
pwd
Hi Michael,

I am in the user's home folder, as the user:
Code:
[email protected]:[~]$ pwd
/home/xxx
[email protected]:[~]$ php -v
ea-php-cli Copyright 2017 cPanel, Inc.
PHP 7.0.33 (cli) (built: Feb 10 2019 12:54:41) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v10.3.2, Copyright (c) 2002-2018, by ionCube Ltd.
    with Zend OPcache v7.0.33, Copyright (c) 1999-2017, by Zend Technologies
    with SourceGuardian v11.2, Copyright (c) 2000-2018, by SourceGuardian Ltd.


If it doesn't show /home/$username/public_html, browse to the user's public_html directory and see if the issue persists. EX:

Code:
cd /home/$username/public_html
php -v
The cron script isn't in the public_html folder, but the PHP version is same:

Code:
[email protected]:[~]$ cd public_html/
xxx[email protected]:[public_html]$ php -v
ea-php-cli Copyright 2017 cPanel, Inc.
PHP 7.0.33 (cli) (built: Feb 10 2019 12:54:41) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v10.3.2, Copyright (c) 2002-2018, by ionCube Ltd.
    with Zend OPcache v7.0.33, Copyright (c) 1999-2017, by Zend Technologies
    with SourceGuardian v11.2, Copyright (c) 2000-2018, by SourceGuardian Ltd.
[email protected]:[public_html]$ whoami
xxx
If you're using CloudLinux, can you share more information about how you've defined the default PHP version and the account's PHP version?

Thank you.
I am not sure what info you're looking for. CloudLinux is installed but I don't see an option in WHM to give users a different PHP version than what they would select in cPanel.
 

Attachments

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,241
363
Hello @SoftDux,

Can you open a support ticket so we can take a closer look at the affected system? Post the ticket number here and I'll link this thread to it.

Thank you.