CentOS - Trying to downgrade php

5,044

everytime something like this happened to me (needing an older copy then what is in repo, or newer) I've found it easier to build my own RPM's from source, and i recommend doing that.

Its not too difficult, just a little more time consuming, and you can ensure your using the latest of everything ELSE on your system, and just the older (or newer) versions of PHP.

http://www.imminentweb.com/technologies/create-centos-php-rpm

should help you with the basics of building your own PHP RPM's on CentOS.

If you continue down the path your headed, your probably going to run into what I call "dependency hell" Old PHP needs old version of X, which is needed by a new version of Y, and if you want the old version of X, you need to downgrade Y as well, so on and so forth. 10-15 dependencies later, your running a reasonably insecure environment because a significant chunk of your system is running old code.

Share:
5,044

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    I need to downgrade PHP 5.3 to 5.2 and I'm on a CentOS 5.5 x86_64 machine running Apache 2.2.3 & MySQL 5.1.54. I've been having some problems and now am just plain lost... Not sure exactly what to include in terms of steps / whatnot, so I'll just try to break down what I did that got me to my breaking point...

    Here are the steps I've taken thus far:

    (1) I tried uninstalling PHP 5.3 with:

    rpm -e --nodeps php-devel php php-cli php-common php-mcrypt php-mysql 
    php-pdo php-ldap php-mbstring php-xml php-xmlrpc php-odbc php-imap 
    php-snmp php-gd
    
    //Yielded:
    warning: /etc/php.ini saved as /etc/php.ini.rpmsave
    

    (2) Then, I tried installing php:

    yum install php-devel php php-cli php-common php-mcrypt php-mysql php-pdo php-ldap php-mbstring php-xml php-xmlrpc php-odbc php-imap php-snmp php-gd
    

    But, stupidly, I realized (later on) that I didn't specify the repo or the php version. Fortunately (?), nothing was installed because it yielded this:

    Transaction Check Error:
      package libmcrypt-2.5.8-4.el5.centos.x86_64 (which is newer than libmcrypt-2.5.7-5.el5.i386) is already installed
    

    (3) Although, I didn't notice that at first, so I restarted apache, and ran: yum upgrade

    Which ran through everything fine.

    (4) Edited /etc/my.cnf to put skip-bdb in there and start mysqld

    (5) Ran: mysql_upgrade -uadmin -pcat /etc/psa/.psa.shadow`

    (6) After trying to google for a solution, I came across an article that said I needed yum-allowdowngrade, so, I ran this: yum install yum-allowdowngrade

    (7) To try to make sure I didn't have php installed, I ran: yum remove php

    which yielded:

    Loaded plugins: allowdowngrade, fastestmirror
    Setting up Remove Process
    No Match for argument: php
    Loading mirror speeds from cached hostfile
     * atomic: www6.atomicorp.com
     * base: mirror.rackspace.com
     * epel: mirror.cogentco.com
     * extras: mirror.ash.fastserv.com
     * updates: mirror.ash.fastserv.com
    atomic                                                                                        | 1.9 kB     00:00     
    base                                                                                          | 2.1 kB     00:00     
    epel                                                                                          | 3.7 kB     00:00     
    extras                                                                                        | 2.1 kB     00:00     
    rusia-repo                                                                                    |  951 B     00:00     
    updates                                                                                       | 1.9 kB     00:00     
    Package(s) php available, but not installed.
    No Packages marked for removal
    

    (8) Then, I ran:

    yum --allow-downgrade --enablerepo=rusia-repo install php-devel-5.2.17-1.el5.x86_64 php-5.2.17-1.el5.x86_64 php-cli-5.2.17-1.el5.x86_64 php-common-5.2.17-1.el5.x86_64 php-mcrypt-5.2.17-1.el5.x86_64 php-mysql-5.2.17-1.el5.x86_64 php-pdo-5.2.17-1.el5.x86_64 php-ldap-5.2.17-1.el5.x86_64 php-mbstring-5.2.17-1.el5.x86_64 php-xml-5.2.17-1.el5.x86_64 php-xmlrpc-5.2.17-1.el5.x86_64 php-odbc-5.2.17-1.el5.x86_64 php-imap-5.2.17-1.el5.x86_64 php-snmp-5.2.17-1.el5.x86_64 php-gd-5.2.17-1.el5.x86_64 
    

    which yielded:

    Loaded plugins: allowdowngrade, fastestmirror
    Loading mirror speeds from cached hostfile
     * atomic: www6.atomicorp.com
     * base: mirror.rackspace.com
     * epel: mirror.cogentco.com
     * extras: mirror.ash.fastserv.com
     * updates: mirror.ash.fastserv.com
    atomic                                                                                        | 1.9 kB     00:00     
    base                                                                                          | 2.1 kB     00:00     
    epel                                                                                          | 3.7 kB     00:00     
    extras                                                                                        | 2.1 kB     00:00     
    rusia-repo                                                                                    |  951 B     00:00     
    updates                                                                                       | 1.9 kB     00:00     
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package php.x86_64 0:5.2.17-1.el5 set to be updated
    --> Processing Dependency: php-common = 5.2.17-1.el5 for package: php
    --> Processing Dependency: php-cli = 5.2.17-1.el5 for package: php
    --> Finished Dependency Resolution
    php-5.2.17-1.el5.x86_64 from rusia-repo has depsolving problems
      --> Missing Dependency: php-common = 5.2.17-1.el5 is needed by package php-5.2.17-1.el5.x86_64 (rusia-repo)
    php-5.2.17-1.el5.x86_64 from rusia-repo has depsolving problems
      --> Missing Dependency: php-cli = 5.2.17-1.el5 is needed by package php-5.2.17-1.el5.x86_64 (rusia-repo)
    Error: Missing Dependency: php-common = 5.2.17-1.el5 is needed by package php-5.2.17-1.el5.x86_64 (rusia-repo)
    Error: Missing Dependency: php-cli = 5.2.17-1.el5 is needed by package php-5.2.17-1.el5.x86_64 (rusia-repo)
     You could try using --skip-broken to work around the problem
     You could try running: package-cleanup --problems
                            package-cleanup --dupes
                            rpm -Va --nofiles --nodigest
    

    I kept getting a series of these errors, so decided to just run yum update, update back to php 5.3 and see if I could get that working until I figured out how to downgrade correctly...

    So, I ran yum update and got:

    yum update
    Loaded plugins: allowdowngrade, fastestmirror
    Loading mirror speeds from cached hostfile
     * atomic: www6.atomicorp.com
     * base: mirror.rackspace.com
     * epel: mirror.symnds.com
     * extras: mirror.symnds.com
     * updates: mirror.symnds.com
    Setting up Update Process
    No Packages marked for Update
    

    Then, I ran:

    yum install php-devel php php-cli php-common php-mcrypt php-mysql php-pdo php-ldap php-mbstring php-xml php-xmlrpc php-odbc php-imap php-snmp php-gd
    

    But that yielded:

    Transaction Check Error:
      package libmcrypt-2.5.8-4.el5.centos.x86_64 (which is newer than libmcrypt-2.5.7-5.el5.i386) is already installed
      file /usr/bin/phar.phar from install of php-cli-5.3.6-3.el5.art.i386 conflicts with file from package php-cli-5.3.6-3.el5.art.x86_64
      file /usr/bin/phpize from install of php-cli-5.3.6-3.el5.art.i386 conflicts with file from package php-cli-5.3.6-3.el5.art.x86_64
    

    I tried service httpd restart and got:

    Stopping httpd:                                            [FAILED]
    Starting httpd: httpd: Syntax error on line 210 of /etc/httpd/conf/httpd.conf: Syntax error on line 6 of /etc/httpd/conf.d/php.conf: Cannot load /etc/httpd/modules/libphp5.so into server: /etc/httpd/modules/libphp5.so: cannot open shared object file: No such file or directory
    

    So, now, I'm totally confused and really, really need some help...

  • slm
    slm almost 11 years
    Links appears to be broken. Page never loaded.