• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

How to remove PHP 5.4?

Bluesurf

New Pleskian
I am still trying to get the proper php version loaded on my server - something higher than php version 5.4
I have deleted all php 5.4 instances from the Plesk panel. However, the problem persists as I see when I log in as a root user on my server.

When I first ran a php -v command, I received this return:

php -v
PHP 5.4.13 (cli) (built: Mar 14 2013 08:57:49)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v5.0.12, Copyright (c) 2002-2015, by ionCube Ltd.

Everything was working without error, although the php 5.4 version was loaded. I searched "php --ini" and found the loader location. I changed the loader number in /etc/php.d/00-ioncube_loader.ini from 5.4 to 5.6 and restarted the server - it now gives me an error message:

php -v
Failed loading /usr/lib64/php/modules/ioncube_loader_lin_5.6.so: /usr/lib64/php/modules/ioncube_loader_lin_5.6.so: undefined symbol: zend_execute_ex
PHP 5.4.13 (cli) (built: Mar 14 2013 08:57:49)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

previously, I had placed into my /etc/php.ini file a line command directing the server to the proper php version to load -

;zend_extension= /usr/lib64/php/modules/ioncube_loader_lin_5.6.so ; moved to conf.d/zend_extensions_psa.ini by Plesk

you can see that Plesk automatically changed this.

I searched for the correct conf.d directory (folder). I had many choices:

# find / -type d -name conf.d
/usr/share/ghostscript/conf.d
/usr/share/doc/dovecot/example-config/conf.d
/usr/share/doc/plesk-dovecot/dist-config/conf.d
/etc/httpd/conf.d
/etc/sw-engine/conf.d
/etc/nginx/conf.d
/etc/dovecot/conf.d
/etc/sw-cp-server/conf.d
/etc/fonts/conf.d

I searched specifically for the zend_extensions_psa.ini file and found that it only contained this warning:

find / -name "zend_extensions_psa.ini"
/etc/php.d/zend_extensions_psa.ini
[root@d7w2-g8zq /]# nano /etc/php.d/zend_extensions_psa.ini
**** text follows ****
; Following directives were moved from php.ini files by Plesk to avoid load order errors
; Please do not add any zend_extension* or extension directives directly into php.ini

I went back to the loader change that I made at the beginning and when I ran the command: nano /etc/php.d/00-ioncube_loader.ini
I now find a blank file. I don't know if Plesk stripped the loader command out of this file?

When I now run the php --ini command, I get this:
# php --ini
Failed loading /usr/lib64/php/modules/ioncube_loader_lin_5.6.so: /usr/lib64/php/modules/ioncube_loader_lin_5.6.so: undefined symbol: zend_exe
cute_ex
Configuration File (php.ini) Path: /etc
Loaded Configuration File: /etc/php.ini
Scan for additional .ini files in: /etc/php.d
Additional .ini files parsed: /etc/php.d/00-ioncube-loader.ini,
/etc/php.d/curl.ini,
/etc/php.d/dom.ini,
/etc/php.d/fileinfo.ini,
/etc/php.d/gd.ini,
/etc/php.d/imap.ini,
/etc/php.d/json.ini,
/etc/php.d/mbstring.ini,
/etc/php.d/mysql.ini,
/etc/php.d/mysqli.ini,
/etc/php.d/pdo.ini,
/etc/php.d/pdo_mysql.ini,
/etc/php.d/pdo_sqlite.ini,
/etc/php.d/phar.ini,
/etc/php.d/sqlite3.ini,
/etc/php.d/wddx.ini,
/etc/php.d/xmlreader.ini,
/etc/php.d/xmlwriter.ini,
/etc/php.d/xsl.ini,
/etc/php.d/zend_extensions_psa.ini,
/etc/php.d/zip.ini

So, the loader file is still there - it is simply empty.

When I search for what php versions are installed I find this:

# yum list installed | grep php*
php.x86_64 5.4.13-1.el6.remi @mt_dv_extras
php-cli.x86_64 5.4.13-1.el6.remi @mt_dv_extras
php-common.x86_64 5.4.13-1.el6.remi @mt_dv_extras
php-gd.x86_64 5.4.13-1.el6.remi @mt_dv_extras
php-imap.x86_64 5.4.13-1.el6.remi @mt_dv_extras
php-mbstring.x86_64 5.4.13-1.el6.remi @mt_dv_extras
php-mysql.x86_64 5.4.13-1.el6.remi @mt_dv_extras
php-pdo.x86_64 5.4.13-1.el6.remi @mt_dv_extras
php-xml.x86_64 5.4.13-1.el6.remi @mt_dv_extras
php5-ioncube-loader.x86_64 5.0.12-centos6.15081418 installed
plesk-php56.x86_64 5.6.19-centos6.16030413 @plesk-php-5.6
plesk-php56-bcmath.x86_64 5.6.19-centos6.16030413 @plesk-php-5.6
plesk-php56-cli.x86_64 5.6.19-centos6.16030413 @plesk-php-5.6
plesk-php56-dba.x86_64 5.6.19-centos6.16030413 @plesk-php-5.6
plesk-php56-enchant.x86_64 5.6.19-centos6.16030413 @plesk-php-5.6
plesk-php56-fpm.x86_64 5.6.19-centos6.16030413 @plesk-php-5.6
plesk-php56-gd.x86_64 5.6.19-centos6.16030413 @plesk-php-5.6
plesk-php56-imagick.x86_64 3.1.2-centos6.15081011 @PHP_5_6_18-dist
plesk-php56-imap.x86_64 5.6.19-centos6.16030413 @plesk-php-5.6
plesk-php56-intl.x86_64 5.6.19-centos6.16030413 @plesk-php-5.6
plesk-php56-ioncube-loader.x86_64
plesk-php56-ldap.x86_64 5.6.19-centos6.16030413 @plesk-php-5.6
plesk-php56-mbstring.x86_64 5.6.19-centos6.16030413 @plesk-php-5.6
plesk-php56-mcrypt.x86_64 5.6.19-centos6.16030413 @plesk-php-5.6
plesk-php56-mysql.x86_64 5.6.19-centos6.16030413 @plesk-php-5.6
plesk-php56-odbc.x86_64 5.6.19-centos6.16030413 @plesk-php-5.6
plesk-php56-opcache.x86_64 5.6.19-centos6.16030413 @plesk-php-5.6
plesk-php56-pdo.x86_64 5.6.19-centos6.16030413 @plesk-php-5.6
plesk-php56-pear.noarch 1.9.4-centos6.16030413 @plesk-php-5.6
plesk-php56-pgsql.x86_64 5.6.19-centos6.16030413 @plesk-php-5.6
plesk-php56-process.x86_64 5.6.19-centos6.16030413 @plesk-php-5.6
plesk-php56-pspell.x86_64 5.6.19-centos6.16030413 @plesk-php-5.6
plesk-php56-redis.x86_64 2.2.5-centos6.15081011 @PHP_5_6_18-dist
plesk-php56-release.x86_64 5.6.19-centos6.16030413 @plesk-php-5.6
plesk-php56-snmp.x86_64 5.6.19-centos6.16030413 @plesk-php-5.6
plesk-php56-soap.x86_64 5.6.19-centos6.16030413 @plesk-php-5.6
plesk-php56-tidy.x86_64 5.6.19-centos6.16030413 @plesk-php-5.6
plesk-php56-xdebug.x86_64 2.2.3-centos6.15081011 @PHP_5_6_18-dist
plesk-php56-xml.x86_64 5.6.19-centos6.16030413 @plesk-php-5.6
plesk-php56-xmlrpc.x86_64 5.6.19-centos6.16030413 @plesk-php-5.6
plesk-php70.x86_64 7.0.4-centos6.16030412 @plesk-php-7.0
plesk-php70-bcmath.x86_64 7.0.4-centos6.16030412 @plesk-php-7.0
plesk-php70-cli.x86_64 7.0.4-centos6.16030412 @plesk-php-7.0
plesk-php70-dba.x86_64 7.0.4-centos6.16030412 @plesk-php-7.0
**** (more php70)
plesk-php70-xml.x86_64 7.0.4-centos6.16030412 @plesk-php-7.0
plesk-php70-xmlrpc.x86_64 7.0.4-centos6.16030412 @plesk-php-7.0
psa-php5-configurator.x86_64 1.7.0-cos6.build1205150820.19 @PLESK_12_5_30-dist
psa-phpmyadmin.noarch 4.5.5-cos6.build1205160229.16 @PLESK_12_5_30-dist
psa-phppgadmin.noarch 5.1-cos6.build1205150814.17 installed

When I search for the location of PHP on the system I get this return:

# whereis php
php: /usr/bin/php /etc/php.ini /etc/php.d /usr/lib64/php /usr/share/php /usr/share/man/man1/php.1.gz


How do I force Plesk to load the php 5.6?? I deleted php 5.4 from the Plesk panel, but as a root user I still see that php 5.4 is loaded and running as the base php.
 
That shows me how to remove PHP versions through the Plesk panel. I have done that, but still find php 5.4 running as my base php when I go check my server as root user.
 
The PHP interpreter you are referring to is the system PHP - it is not installed or used by Plesk. It is generally not recommended to axe it - you can google "centos update php" to learn how to bring it up-to-date (there are no Plesk-specific instructions, it's 100% OS system administration).

Alternatively, you can configure your system to use the Plesk PHP interpreter instead of the system one:

[root@ppu12-5 ~]# php -v
PHP 5.3.3 (cli) (built: Feb 9 2016 10:21:34)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v5.0.12, Copyright (c) 2002-2015, by ionCube Ltd.

[root@ppu12-5 ~]# export PATH=/opt/plesk/php/5.6/bin:${PATH}

[root@ppu12-5 ~]# php -v
PHP 5.6.20 (cli) (built: Apr 5 2016 12:08:28)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v5.0.18, Copyright (c) 2002-2015, by ionCube Ltd.
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
 
Thank you. I haven't tried it yet, but the command "export PATH=/opt/plesk/php/5.6/bin:${PATH}" - this must be done every session, every time the server is started? Or, it is a line that I must insert in the php.ini file? I think this will fix the problem, but I have posted on the Centos forum to see if they have heartburn with this solution. Again, many thanks.
 
this must be done every session, every time the server is started?

You need to add export statements to ~/.bash_profile or ~/.profile or /etc/profile file. This will export variables permanently:
$ vi ~/.bash_profile
Read more about it here.
 
Back
Top