简体   繁体   中英

Downgrade php5 to 5.4.9-4ubuntu2.2 in Ubuntu 13.10

I recently updated to Ubuntu 13.10, and am having a versioning issue with PHP.

A client I have uses an older version of php5, of which the most current version that will work with it without deprecation errors is 5.4.9-4ubuntu2.2 . Ubuntu 13.10 ships with 5.5.3-1ubuntu2 .

I'd like to know if there is a way to get 5.4.9-4ubuntu2.2 to install on 13.10 without needing to resort to compiling source packages. I figure there must be a command line to apt-get to install an older version, which I'm just not aware of.

I have tried sudo apt-get install php5=5.4.9-4ubuntu2.2 without success.

Any help is greatly appreciated.

I'm having the same issue, and found the following solution. I'm testing it soon and will post back with results, but it looks solid.

# upgrade system, so you can add to ignore all updates later
sudo apt-get update
sudo apt-get upgrade

# remove your php, apache, etc
sudo apt-get purge apache2 php5 libapache2-mod-php5 # add here your server packages

# change repositories to raring  (with backup)
sudo sed -i.bak "s/saucy/raring/g" /etc/apt/sources.list

# update and install server packages
sudo apt-get update
sudo apt-get install apache2 php5 libapache2-mod-php5 phpmyadmin 

# change repositories back to saucy
sudo sed -i "s/raring/saucy/g" /etc/apt/sources.list

# ignore all current upgrades (package hold)
dpkg --get-selections | egrep '^(apache|php)' | sed 's/install/hold/g' | sudo dpkg --set-selections

E_DEPRECATED messages are informational , not to be considered on the same levels as even a warning. Their purpose is simply to inform developers that some functionality they are using will disappear in a future version.

From the documentation :

Run-time notices. Enable this to receive warnings about code that will not work in future versions.

While these notices may be useful in development, they should most certainly be disabled in production. You can do this by adding ~E_DEPRECATED to your error_reporting line in php.ini, or by adding the following line to your script/application:

error_reporting(error_reporting() ~E_DEPRECATED);

Function documentation .

If I've read your comment correctly, these messages are stemming from your use of the mysql_* family of functions which were deprecated as of PHP 5.5. These functions are still widely in use and while they could be removed starting in PHP 5.6, it's still up for debate.

Short answer: you shouldn't have to downgrade anything, just turn down your error reporting settings a tad so they are not generated.

My solution:

sudo add-apt-repository 'deb http://cn.archive.ubuntu.com/ubuntu raring main'    #add back raring
sudo apt-get update
sudo apt-get remove php5-cli php5-common
sudo apt-get install php5-cli=5.4.9-4ubuntu2    #specify php version, lookup versions from: apt-cache policy php5-cli
sudo apt-mark hold php5-cli    #hold the version

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM