Page 1 of 3 123 LastLast
Results 1 to 10 of 63

Thread: downgrade php / installing php5.2 next to php 5.3

Hybrid View

  1. #1
    Join Date
    Jul 2008
    Beans
    12

    Re: downgrade php / installing php5.2 next to php 5.3

    That sounds like a "no, 'cos you won't get it through the repository"?

  2. #2
    Join Date
    Nov 2007
    Beans
    51

    Thumbs down Re: Reverting PHP to 5.2 in Lucid 10.04

    I created a script solution for

    Reverting PHP to 5.2 in Lucid 10.04

    but i may not post it there so i tell you here now

    create the script
    Code:
    #!/bin/bash
    # by Ruben Barkow (rubo77) http://www.entikey.z11.de/
    
    # Originally Posted by Bachstelze http://ubuntuforums.org/showthread.php?p=9080474#post9080474
    # OK, here's how to do the Apt magic to get PHP packages from the karmic repositories:
    
    echo "Am I root?  "
    if [ "$(whoami &2>/dev/null)" != "root" ] && [ "$(id -un &2>/dev/null)" != "root" ] ; then
      echo "  NO!
    
    Error: You must be root to run this script.
    Enter
    sudo su
    "
      exit 1
    fi
    echo "  OK";
    
    
    #install aptitude before, if you don`t have it:
    apt-get install aptitude
    # or if you prefer apt-get use:
    # alias aptitude='apt-get'
    
    # finish all apt-problems:
    aptitude update
    aptitude -f install
    #apt-get -f install
    
    # remove all your existing PHP packages. You can list them with dpkg -l| grep php
    PHPLIST=$(for i in $(dpkg -l | grep php|awk '{ print $2 }' ); do echo $i; done)
    echo these pachets will be removed: $PHPLIST 
    # you need not to purge, if you have upgraded from karmic:
    aptitude remove $PHPLIST
    # on a fresh install, you need purge:
    # aptitude remove --purge $PHPLIST
    
    
    #Create a file each in /etc/apt/preferences.d like this (call it for example /etc/apt/preferences.d/php5_2);
    #
    #Package: php5
    #Pin: release a=karmic
    #Pin-Priority: 991
    #
    #The big problem is that wildcards don't work, so you will need one such stanza for each PHP package you want to pull from karmic:
    
    echo ''>/etc/apt/preferences.d/php5_2
    for i in $PHPLIST ; do echo "Package: $i
    Pin: release a=karmic
    Pin-Priority: 991
    ">>/etc/apt/preferences.d/php5_2; done
    
    # duplicate your existing sources.list replacing lucid with karmic and save it in sources.list.d:
    #sed s/lucid/karmic/g /etc/apt/sources.list | sudo tee /etc/apt/sources.list.d/karmic.list
    
    # better exactly only the needed sources, cause otherwise you can get a cachsize problem:
    echo "# needed sources vor php5.2:
    deb http://old-releases.ubuntu.com/ubuntu/ karmic main restricted
    deb-src http://old-releases.ubuntu.com/ubuntu/ karmic main restricted
    
    deb http://old-releases.ubuntu.com/ubuntu/ karmic-updates main restricted
    deb-src http://old-releases.ubuntu.com/ubuntu/ karmic-updates main restricted
    
    deb http://old-releases.ubuntu.com/ubuntu/ karmic universe
    deb-src http://old-releases.ubuntu.com/ubuntu/ karmic universe
    deb http://old-releases.ubuntu.com/ubuntu/ karmic-updates universe
    deb-src http://old-releases.ubuntu.com/ubuntu/ karmic-updates universe
    
    deb http://old-releases.ubuntu.com/ubuntu/ karmic multiverse
    deb-src http://old-releases.ubuntu.com/ubuntu/ karmic multiverse
    deb http://old-releases.ubuntu.com/ubuntu/ karmic-updates multiverse
    deb-src http://old-releases.ubuntu.com/ubuntu/ karmic-updates multiverse
    
    deb http://old-releases.ubuntu.com/ubuntu karmic-security main restricted
    deb-src http://old-releases.ubuntu.com/ubuntu karmic-security main restricted
    deb http://old-releases.ubuntu.com/ubuntu karmic-security universe
    deb-src http://old-releases.ubuntu.com/ubuntu karmic-security universe
    deb http://old-releases.ubuntu.com/ubuntu karmic-security multiverse
    deb-src http://old-releases.ubuntu.com/ubuntu karmic-security multiverse
    " > /etc/apt/sources.list.d/karmic.list
    
    aptitude update
    
    apache2ctl restart
    
    echo install new from karmic:
    aptitude -t karmic install $PHPLIST
    
    # at the end retry the modul libapache2-mod-php5 in case it didn't work the first time:
    aptitude -t karmic install libapache2-mod-php5
    
    apache2ctl restart
    make it executeable:
    Code:
    chmod +x /usr/local/sbin/php5.2-downgrade
    edit:
    i added the historical karmic sources:
    Code:
    http://old-releases.ubuntu.com/ubuntu/
    Attached Files Attached Files
    Last edited by rubo77; December 8th, 2011 at 11:58 AM. Reason: no dots in filenme /etc/apt/preferences.d/php5.2 !!! And 'apt-get' hint added

  3. #3
    Join Date
    Aug 2006
    Beans
    8
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: downgrade php / installing php5.2 next to php 5.3

    Thank you very much fors this script.
    It saved my day.

  4. #4
    Join Date
    Nov 2007
    Beans
    51

    Exclamation Re: downgrade php / installing php5.2 next to php 5.3

    the problem now is, that the update manager wants to upgrade php to 5.3 now everytime

    to tell the update-manager not to do so, you have to set the php packages to hold with
    Code:
    for i in $(dpkg -l | grep php|awk '{ print $2 }' ); 
    do echo "echo $i hold |sudo dpkg --set-selections"; echo $i hold |sudo dpkg --set-selections; done
    or so?

  5. #5
    Join Date
    Nov 2009
    Beans
    2

    Re: downgrade php / installing php5.2 next to php 5.3

    Thank a lot for the script...
    One warning though... aptitude wanted to remove some 338M of packages from my computer... if I use apt-get instead it does not remove anything but the pap packs...
    Take care
    Martin

  6. #6
    Join Date
    Nov 2007
    Beans
    51

    Question Re: downgrade php / installing php5.2 next to php 5.3

    please lets not discuss
    google.com/search?q="aptitude+vs+apt-get"
    here
    (sure: you can use apt-get if you prefer that)

    one notion:

    the file
    Code:
    /etc/apt/preferences.d/php5.2
    must be called
    Code:
    /etc/apt/preferences.d/php5_2
    without dots !!!
    Last edited by rubo77; May 12th, 2010 at 06:09 AM. Reason: i found the solution to the prior question here: no dots in filename!!!

  7. #7
    Join Date
    May 2010
    Beans
    7
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: downgrade php / installing php5.2 next to php 5.3

    Thanks for your script, it was helpful.

    Btw, I used Hardy instead of Karmic since Hardy as a newest version of PHP (v. 5.2.4-2ubuntu5.10) and the Karmic version was giving me warnings... I also change the mirror, I'm not sure where http://de... is but it's definitely not my country.
    Last edited by gaellafond; May 4th, 2010 at 04:46 AM.

  8. #8
    Join Date
    Jul 2010
    Beans
    1

    Re: downgrade php / installing php5.2 next to php 5.3

    Hi everyone,
    I did downgrade to php 5.2.10 successfully following the steps mentioned above; however, I need to go back to php 5.3.2.
    How should I do it?
    any ideas?

  9. #9
    Join Date
    Jun 2006
    Location
    Netherlands
    Beans
    32
    Distro
    Ubuntu 12.04 Precise Pangolin

    Wink Re: downgrade php / installing php5.2 next to php 5.3

    @ Rubo77:

    Man, you are a star!

    Saved my day with this script.

    Rgds,

    Philip

  10. #10
    Join Date
    Jul 2009
    Location
    Oregon
    Beans
    321

    Re: downgrade php / installing php5.2 next to php 5.3

    This script was extremely useful. I just made a few very small changes to make it work with 10.10

    Here it is
    Code:
    #!/bin/bash
    # by Ruben Barkow (rubo77) http://www.entikey.z11.de/
    
    # Originally Posted by Bachstelze http://ubuntuforums.org/showthread.php?p=9080474#post9080474
    # OK, here's how to do the Apt magic to get PHP packages from the karmic repositories:
    #
    # modified by Ryein C. Bowling (Cardale) www.kinggoddard.com
    # December 15, 2010
    echo "Am I root?  "
    if [ "$(whoami &2>/dev/null)" != "root" ] && [ "$(id -un &2>/dev/null)" != "root" ] ; then
      echo "  NO!
    
    Error: You must be root to run this script.
    Enter
    sudo su
    "
      exit 1
    fi
    echo "  OK";
    
    
    # finish all apt-problems:
    apt-get -f install
    
    # remove all your existing PHP packages. You can list them with dpkg -l| grep php
    PHPLIST=$(for i in $(dpkg -l | grep php|awk '{ print $2 }' ); do echo $i; done)
    echo these pachets will be removed: $PHPLIST 
    # you need not to purge, if you have upgraded from karmic:
    apt-get remove $PHPLIST
    # on a fresh install, you need purge:
    # aptitude remove --purge $PHPLIST
    
    
    #Create a file each in /etc/apt/preferences.d like this (call it for example /etc/apt/preferences.d/php5_2);
    #
    #Package: php5
    #Pin: release a=karmic
    #Pin-Priority: 991
    #
    #The big problem is that wildcards don't work, so you will need one such stanza for each PHP package you want to pull from karmic:
    
    echo ''>/etc/apt/preferences.d/php5_2
    for i in $PHPLIST ; do echo "Package: $i
    Pin: release a=karmic
    Pin-Priority: 991
    ">>/etc/apt/preferences.d/php5_2; done
    
    # duplicate your existing sources.list replacing lucid with karmic and save it in sources.list.d:
    #sed s/lucid/karmic/g /etc/apt/sources.list | sudo tee /etc/apt/sources.list.d/karmic.list
    
    # better exactly only the needed sources, cause otherwise you can get a cachsize problem:
    echo "# needed sources vor php5.2:
    deb http://de.archive.ubuntu.com/ubuntu/ karmic main restricted
    deb-src http://de.archive.ubuntu.com/ubuntu/ karmic main restricted
    
    deb http://de.archive.ubuntu.com/ubuntu/ karmic-updates main restricted
    deb-src http://de.archive.ubuntu.com/ubuntu/ karmic-updates main restricted
    
    deb http://de.archive.ubuntu.com/ubuntu/ karmic universe
    deb-src http://de.archive.ubuntu.com/ubuntu/ karmic universe
    deb http://de.archive.ubuntu.com/ubuntu/ karmic-updates universe
    deb-src http://de.archive.ubuntu.com/ubuntu/ karmic-updates universe
    
    deb http://de.archive.ubuntu.com/ubuntu/ karmic multiverse
    deb-src http://de.archive.ubuntu.com/ubuntu/ karmic multiverse
    deb http://de.archive.ubuntu.com/ubuntu/ karmic-updates multiverse
    deb-src http://de.archive.ubuntu.com/ubuntu/ karmic-updates multiverse
    
    deb http://security.ubuntu.com/ubuntu karmic-security main restricted
    deb-src http://security.ubuntu.com/ubuntu karmic-security main restricted
    deb http://security.ubuntu.com/ubuntu karmic-security universe
    deb-src http://security.ubuntu.com/ubuntu karmic-security universe
    deb http://security.ubuntu.com/ubuntu karmic-security multiverse
    deb-src http://security.ubuntu.com/ubuntu karmic-security multiverse
    " >> /etc/apt/sources.list.d/karmic.list
    
    apt-get update
    
    apache2ctl restart
    
    echo install new from karmic:
    apt-get -t karmic install $PHPLIST
    
    # at the end retry the modul libapache2-mod-php5 in case it didn't work the first time:
    apt-get -t karmic install libapache2-mod-php5
    
    apache2ctl restart
    Asus G73JW ROG-A3B7M
    Intel Core i7 || 16GB RAM || 802.11n+BT || 2 x 500GB Hybrid Drives || Nvidia GTX 460M

Page 1 of 3 123 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •