Wednesday, May 8, 2024
 Popular · Latest · Hot · Upcoming
8
rated 0 times [  8] [ 0]  / answers: 1 / hits: 60494  / 1 Year ago, sat, may 6, 2023, 7:16:52

I need to downgrade my PHP version from 5.5.9 to 5.4 (using Ubuntu 14.04), because I have a code that's using mySQL (which is deprecated in 5.5.9), and I cannot change that code. Is there a way to do it?



*I tried the other threads that I saw about that issue in the site, but I couldn't find anything that helped me.


More From » 14.04

 Answers
1

First you need to remove all php5 files :



sudo apt-get remove --purge `dpkg -l | grep php | grep -w 5.5 | awk '{print $2}' | xargs`


After that try to search for php 5.4. available resources :



apt-cache policy php5


My result :



php5:
Installed: (none)
Candidate: 5.5.9+dfsg-1ubuntu4.4
Version table:
5.5.9+dfsg-1ubuntu4.4 0
500 http://archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
500 http://archive.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
5.5.9+dfsg-1ubuntu4 0
500 http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages


If there is no resources available than we need to add some by following command :



echo "deb http://php53.dotdeb.org stable all" | sudo tee -a /etc/apt/sources.list


and



apt-get update


If there is a problem with signatures like following :



Reading package lists... Done
W: GPG error: http://php53.dotdeb.org stable Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY xxxxxCODExxxx


we need to sign our Deb repository by commands :



gpg --keyserver keys.gnupg.net --recv-key xxxxxCODExxxx
gpg -a --export xxxxxCODExxxx | sudo apt-key add - apt-get update


After that execute :



sudo apt-get update
apt-cache policy php5


you should see last result :



php5:
Installed: (none)
Candidate: 5.5.9+dfsg-1ubuntu4.4
Version table:
5.5.9+dfsg-1ubuntu4.4 0
500 http://archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
500 http://archive.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
5.5.9+dfsg-1ubuntu4 0
500 http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
5.4.33-1~dotdeb.1 0
500 http://php53.dotdeb.org/ stable/all amd64 Packages


and finally install your version by hitting :



apt-get install php5=5.4.33-1~dotdeb.1


Enjoy ;)


[#24118] Sunday, May 7, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
cisccla

Total Points: 66
Total Questions: 134
Total Answers: 115

Location: Croatia
Member since Fri, Sep 11, 2020
4 Years ago
;