2

I have installed a new version (7.1) of PHP on my server running RHEL 6. I can verify the installation and also via the web-server I see version 7.1 to be used. On the command line, however, I get

php -v
PHP 5.6.8 (cli) (built: Apr 17 2015 15:13:59) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

rpm -qa only shows version 7.1:

rpm -qa | grep php
php71w-cli-7.1.32-1.w6.x86_64
php71w-mbstring-7.1.32-1.w6.x86_64
php71w-pdo-7.1.32-1.w6.x86_64
mod_php71w-7.1.32-1.w6.x86_64
php71w-common-7.1.32-1.w6.x86_64
php71w-mysql-7.1.32-1.w6.x86_64

Any ideas where this reference to 5.6.8 comes from and whether this is a potential problem?

1 Answers1

0

I am suspecting that you have your PHP linked to the old binary that was not removed correctly or your path still point to the old binaries directory.

CASE 1

1- Execute the below command and check the symlink that php is linked to :

ls -ltr "$(sudo which php)" 

So you will find which version is used.

2- Check your path and update it with the new php bin directory :

echo $PATH
sudo  export PATH=$PATH:<php_bin_dir>

3-- Rebuild RPM database :

sudo rpm -vv --rebuilddb

4- Check if the old packages still there :

sudo rpm -qa | grep php
sudo yum list installed | grep php

CASE 2

1- Did you removed the old PHP packages, if not remove them and issue new installation i suggest you to use epel and remi repositories ( Disable all the existing repos ) :

sudo yum remove php*
sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
    sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
    sudo yum-config-manager --enable remi-php71
    sudo yum update
    sudo yum install php

2- Do you have a valid RHEL subscription, if yes then you can register within subscription-manager then enable Software Collections ** repository to install rh-php71 and use **SCL to enable the targeted version.

3- If nothing of these helped you then use alternatives and set php71 as default then switch to it.

Also share the output of the above commands.