Link to home
Start Free TrialLog in
Avatar of lwfuk
lwfuk

asked on

PHP: Remove 5.3 and install 5.2 Centos 5.2

Hi

I ran:-  yum install php-mbstring

And it updated my whole php installation from 5.2.8 to 5.3.

Now loads of things don't work.

How should I remove 5.3 and reinstall 5.2.8?

Kind Regards,
Avatar of medvedd
medvedd

First you need to allow downgrade for yum:

yum install yum-allowdowngrade

Add a line to  yum.conf:

showdupesfromrepos=1

After that list all php packages:

yum list php

If php 5.2.8 is available, remove new one:

yum remove php

and install an old one:

yum --allow-downgrade install php-5.2.8
Avatar of lwfuk

ASKER

hi medvedd

Many thanks for the posting. I'll give it a try tomorrow.

Kind Regards,

Adrian Smith
Avatar of lwfuk

ASKER

Morning Medvedd

Still having a few problems.

Rather than write an essay on what's wrong I've posted this journal.

Kind Regards,

Adrian Smith
[~]# yum install yum-allowdowngrade
epel                      100% |=========================| 3.4 kB    00:00
remi                      100% |=========================| 2.0 kB    00:00
base                      100% |=========================| 1.1 kB    00:00
updates                   100% |=========================|  951 B    00:00
addons                    100% |=========================|  951 B    00:00
extras                    100% |=========================| 1.1 kB    00:00
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package yum-allowdowngrade.noarch 0:1.1.16-13.el5.centos set to be updated
--> Finished Dependency Resolution
 
Dependencies Resolved
 
=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 yum-allowdowngrade      noarch     1.1.16-13.el5.centos  base               11 k
 
Transaction Summary
=============================================================================
Install      1 Package(s)
Update       0 Package(s)
Remove       0 Package(s)
 
Total download size: 11 k
Is this ok [y/N]: y
Downloading Packages:
(1/1): yum-allowdowngrade 100% |=========================|  11 kB    00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: yum-allowdowngrade           ######################### [1/1]
 
Installed: yum-allowdowngrade.noarch 0:1.1.16-13.el5.centos
Complete!
[~]# find -name yum.conf
[~]# cd /
[/]# find -name yum.conf
find: ./proc/7203/net: Invalid argument
find: ./proc/14809/net: Invalid argument
find: ./proc/26217/net: Invalid argument
find: ./proc/31559/net: Invalid argument
./etc/yum.conf
[/]# vi /etc/yum.conf
[/]# yum list php
Loading "allowdowngrade" plugin
epel                      100% |=========================| 3.4 kB    00:00
remi                      100% |=========================| 2.0 kB    00:00
base                      100% |=========================| 1.1 kB    00:00
updates                   100% |=========================|  951 B    00:00
addons                    100% |=========================|  951 B    00:00
extras                    100% |=========================| 1.1 kB    00:00
Available Packages
php.x86_64                               5.3.0-2.el5.remi.2     remi
php.x86_64                               5.2.10-1.el5.remi      remi
php.x86_64                               5.1.6-23.el5           base
php.x86_64                               5.1.6-23.2.el5_3       updates
[/]# yum remove php
Loading "allowdowngrade" plugin
Setting up Remove Process
No Match for argument: php
No Packages marked for removal
 
/*********************************************
**
** Note that I ran yum remove php yesterday 
** before we started this thread so 
** "No Packages marked for removal" is as expected
**
*********************************************/
 
[/]# yum --allow-downgrade install php-5.2.10
Loading "allowdowngrade" plugin
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:5.2.10-1.el5.remi set to be updated
--> Processing Dependency: php-cli = 5.2.10-1.el5.remi for package: php
--> Processing Dependency: php-common = 5.2.10-1.el5.remi for package: php
--> Finished Dependency Resolution
Error: Missing Dependency: php-cli = 5.2.10-1.el5.remi is needed by package php
Error: Missing Dependency: php-common = 5.2.10-1.el5.remi is needed by package php
 
[/]# yum --allow-downgrade install php-5.1.6-23.e15
Loading "allowdowngrade" plugin
Setting up Install Process
Parsing package install arguments
No package php-5.1.6-23.e15 available.
Nothing to do
[/]# 5.1.6-23.el5
[/]# yum --allow-downgrade install php-5.2.10
Loading "allowdowngrade" plugin
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:5.2.10-1.el5.remi set to be updated
--> Processing Dependency: php-cli = 5.2.10-1.el5.remi for package: php
--> Processing Dependency: php-common = 5.2.10-1.el5.remi for package: php
--> Finished Dependency Resolution
Error: Missing Dependency: php-cli = 5.2.10-1.el5.remi is needed by package php
Error: Missing Dependency: php-common = 5.2.10-1.el5.remi is needed by package php
 
[/]# yum --allow-downgrade install php-5.2.10
[/]# yum --allow-downgrade install php-5.2.10-1.el5.remi
Loading "allowdowngrade" plugin
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:5.2.10-1.el5.remi set to be updated
--> Processing Dependency: php-cli = 5.2.10-1.el5.remi for package: php
--> Processing Dependency: php-common = 5.2.10-1.el5.remi for package: php
--> Finished Dependency Resolution
Error: Missing Dependency: php-cli = 5.2.10-1.el5.remi is needed by package php
Error: Missing Dependency: php-common = 5.2.10-1.el5.remi is needed by package php
 
[/]#
[/]# php -v
PHP:  syntax error, unexpected TC_STRING in /etc/php.ini on line 74
PHP 5.3.0 (cli) (built: Jul 19 2009 18:22:52)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies
 
/*********************************************
**
** Ran reboot and logged back in
** Notice that PHP is still there.
**
*********************************************/
 
[~]# php -v
PHP:  syntax error, unexpected TC_STRING in /etc/php.ini on line 74
PHP 5.3.0 (cli) (built: Jul 19 2009 18:22:52)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies

Open in new window

Since you are using remi repository for php stuff, you should add --enablerepo=remi to yum arguments (or enable it permanently in /etc/yum.repos.d/*)

I think that 'yum remove php' did not remove php, can you ask after that 'which php'?


Avatar of lwfuk

ASKER

I installed v5.3 again and then removed it. Here are the results.

Cheers,
[/]# yum remove php
Loading "allowdowngrade" plugin
Setting up Remove Process
epel                      100% |=========================| 3.4 kB    00:00
remi                      100% |=========================| 2.0 kB    00:00
base                      100% |=========================| 1.1 kB    00:00
updates                   100% |=========================|  951 B    00:00
addons                    100% |=========================|  951 B    00:00
extras                    100% |=========================| 1.1 kB    00:00
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:5.3.0-2.el5.remi.2 set to be erased
--> Finished Dependency Resolution
 
Dependencies Resolved
 
=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Removing:
 php                     x86_64     5.3.0-2.el5.remi.2  installed         3.5 M
 
Transaction Summary
=============================================================================
Install      0 Package(s)
Update       0 Package(s)
Remove       1 Package(s)
 
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing   : php                          ######################### [1/1]
 
Removed: php.x86_64 0:5.3.0-2.el5.remi.2
Complete!
[/]# which php
/usr/bin/php

Open in new window

It looks like you have installed php without yum. Let's find rpm:

rpm -qf /usr/bin/php

rpm -qa | grep php
Avatar of lwfuk

ASKER

Ah! You're right. I didn't install it but I remeber seeing the rpm in the putty memory.

Here are the results of the last commands.

Kind Regards
[~]# rpm -qf /usr/bin/php
php-cli-5.3.0-2.el5.remi.2
[~]# rpm -qa | grep php
php-pdo-5.3.0-2.el5.remi.2
php-xml-5.3.0-2.el5.remi.2
php-ldap-5.3.0-2.el5.remi.2
php-5.3.0-2.el5.remi.2
php-pear-1.7.2-2.el5.remi
php-pear-Mail-mimeDecode-1.5.0-3.el5.remi
php-common-5.3.0-2.el5.remi.2
php-cli-5.3.0-2.el5.remi.2
php-odbc-5.3.0-2.el5.remi.2
php-gd-5.3.0-2.el5.remi.2
php-imap-5.3.0-2.el5.remi.2
php-pear-Net-Socket-1.0.8-1.el5.centos
php-pear-Mail-Mime-1.5.2-4.el5.remi
php-mbstring-5.3.0-2.el5.remi.2
php-mysql-5.3.0-2.el5.remi.2
[~]#

Open in new window

Avatar of lwfuk

ASKER

Actually - on looking at the list above I am confused.

I definatly used yum install php to install php5.3.

I wouldn't know how to install an rpm without looking it up.
ASKER CERTIFIED SOLUTION
Avatar of medvedd
medvedd

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lwfuk

ASKER

Many thanks you have been very helpful.

Adrian is now your friend :@)
I'm glad that it works. One thing I forgot - to prevent accidental updates, change showdupesfromrepos=1 to showdupesfromrepos=0 in your yum.conf file, and add a line to it (list all php-related packages you don't want to update)

exclude=php php-cli
Avatar of lwfuk

ASKER

Great tip! I wish I'd know you before.