I had default php 5.6 on debian 8.5 but needed to downgrade to 5.3 (or 5.5) so I used below command to remove php
apt-get purge php5 php-pear php5-mysql (used same to install)
and then downloaded php 5.3 sources and installed. Now CLI command #php -v shows 5.3 while PHP_VERSION constant of php still shows 5.6
How to completely clear 5.6 and install 5.2 (or 5.5)
Thanks
raghuu
September 8, 2016, 5:02am
#2
Hi
You can use rpm for removing php completely
rpm -qa | grep -i php*
later that remove the php package which is unnecessary for you
rpm -ev php-5.6.****
Thanks for replying. Already tried it but it says
root@voip:~# rpm -ev php-5.6*
rpm: RPM should not be used directly install RPM packages, use Alien instead!
rpm: However assuming you know what you are doing…
error: package php-5.6* is not installed
however php version which I installed via sources is shown by below command
root@voip:~# php -v
PHP 5.3.20 (cli) (built: Sep 4 2016 14:40:10)
Copyright © 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright © 1998-2012 Zend Technologies
still trying to run a php page in web browser fails and whole php file is simply printed in browser.
Strange
raghuu
September 8, 2016, 5:36am
#4
No you should not use php-5.6* for removing, you have to remove packages one by one
first list all the available php packages
#rpm -qa | grep -i php*
after that remove the selected package by using -e
#rpm -ev php-5.6.XXXX
There are no available packages shown by using
#rpm -qa | grep -i php*
and now PHP_VERSION is empty which means somehow I have got rid of 5.6 but version 5.3 is not working… wonder why!
raghuu
September 8, 2016, 6:12am
#6
It seems like you have installed php improperly once check the available packages if any php package exists remove it and install agani
for listing installed packages and also share the out put of below command
#yum list installed | grep -i php
or use rpm to list the packages
#rpm -qa | grep -i php
if you found any packages remove them using yum or rpm
yum remove php*
(or)
rpm -ev php-5.1.6-45.el5_11
now install the required php version
#yum install php53
if you don’t find latest version of php then configure EPEL and Remi repo’s
https://support.rackspace.com/how-to/install-epel-and-additional-repositories-on-centos-and-red-hat/
and enable the remi repo by editing the repo file
#vim /etc/yum.repo.d/remi.repo
enabled=1
Thanks again for you ongoing help… I am using Debian 8.5 so yum won’t run here, instead I used apt-get as below
root@voip:~# dpkg --get-selections | grep -i php
libapache2-mod-php5 deinstall
php-pear deinstall
php5-cli deinstall
php5-common deinstall
php5-json deinstall
php5-mysql deinstall
php5-readline deinstall
root@voip:~#
While php version command on cli shows this
root@voip:~# php -v
PHP 5.3.20 (cli) (built: Sep 4 2016 14:40:10)
Copyright © 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright © 1998-2012 Zend Technologies
Thanks
apt-get install php5=5.4.45 isn’t working either
raghuu
September 8, 2016, 10:45am
#9
Have you configured repositories once look at the below link it may help you
or download the packages from below link and install manually
https://packages.debian.org/wheezy/php5
i hope these will help you
Thanks, I will follow these instructions and let you know