How to Downgrade PHP version from 5.4 to 5.3 in ubuntu 12.10 (Quantal)

This tutorial will explain how Downgrade PHP version from 5.4 to 5.3 in ubuntu 12.10.

Note:- Use this script with your own risk

Procedure to follow

First you need to download the shell script from here

Once you have file you need to change the permissions using the following command

sudo chmod 755

Now you can run the script using the following command

sudo sh

Follow the on screen instructions

Via Ubuntu Forums

Sponsored Link

You may also like...

26 Responses

  1. Luca says:

    Thank a lot fro script!!! You save my life!!!!

  2. Luis Lobo Borobia says:

    You have just saved my day!

  3. burbing says:

    +1 thnx.

  4. Franleplant says:

    Hi there! I needed Php 5.3 to get somethings working in my local computer, there are all about my current job, I search and tried a lot of solution but this one was the first and online to get the work done.


  5. GaxZE says:

    Awesome ! thanks

  6. mohamed says:

    WoooooooW thats awesome !!!

    You really made it easy for me after hours of trials and searching !!

    Thank You A Million !

  7. me says:

    Would be nice if you mentioned what the script does? Compile from source? Change sources.list?

  8. Don Mostro says:

    This script broke some php dependencies, now i cant install php5-curl.

    the message:

    Depends: phpapi-20100525
    Depends: php5-common (=5.4.6-1ubuntu1.1) but 5.3.10-1ubuntu3 is to be installed

  9. tashi tshering says:

    Just perfect script. Saved my day.

  10. Bruno says:

    What if I need to upgrade to 5.4 after?

  11. flashpassion says:

    in /etc/apt/preferences.d/php5_3

    just add follow :

    Package: php5-curl
    Pin: release a=precise
    Pin-Priority: 991

    #apt-get update
    #apt-get install php5-curl

  12. Michael says:

    How do I undo what this script did? I have ubuntu 12.10

  13. Anuj says:

    Hi I am on 13.04 raring, and somehow updated to php5.4.9 now when i run this script it removes and installs the same version again.

    I want to downgrade to <5.4, any suggestion would be helpful.

  14. christian says:

    Hello, I run the script, how to undo the changes to go back to 5.4?

  15. disko says:

    God bless ya!!!

  16. aurelian says:

    this helped me a lot.

  17. george says:

    =;) You saved me…

  18. Jonathan Bourny says:

    Thank you, why it’s not in the default repo? It could be easier… (It’s the first time that I comment a post, congratulation to me 🙂

  19. absoludo says:

    Hi Michael,

    To undo this script you can simply (re)move the file /etc/apt/preferences.d/php5_3 as sudo user and then do a an update
    sudo apt-get update && sudo apt-get upgrade

  20. absoludo says:

    I forgot that after this you should reinstall php5 using

    for i in $(dpkg -l | grep php|awk ‘{ print $2 }’ ); do sudo apt-get install –reinstall $i; done

    Ofcourse this is also at own risk.

  21. absoludo says:

    Oh and you might want to (re)move the sources list added. You can find it here


  22. Andranik says:

    WOOOOOWW!!! Thank you very much man!! it is a great script!! It has saved me a lot of time !

  23. Thiago Elias says:

    Hero of the day: Saved my life.

  24. perro-verde says:

    if you dont want to loose your phpmyadmin, then edit line 35
    PHPLIST=$(for i in $(dpkg -l | grep php|awk ‘{ print $2 }’ ); do echo $i; done)

    PHPLIST=$(for i in $(dpkg -l | grep php5|awk ‘{ print $2 }’ ); do echo $i; done)

  25. moczówka says:

    Thanks a lot. In Ubuntu 13.04 it Works!
    PHP has been downgraded to version 5.3.10

  26. JamesD says:

    Hi! So I upgraded to Ubuntu to 14.04. Unfortunately, I used your script back on 12.10. Now php is in a really funky state….when I do this:

    PHP 5.3.10-1ubuntu3 with Suhosin-Patch (cli) (built: Apr 11 2012 17:25:33)
    Copyright (c) 1997-2012 The PHP Group
    Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

    but Apache is all messed up now. And if I try and install libapache2-mod-php5….it blows up

    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:

    The following packages have unmet dependencies:
    libapache2-mod-php5 : Depends: php5-common (= 5.5.9+dfsg-1ubuntu4) but 5.3.10-1ubuntu3 is to be installed
    E: Unable to correct problems, you have held broken packages.

    How do I “undo” this script for 14.10?

Leave a Reply

Your email address will not be published. Required fields are marked *