0

I'm trying to upgrade php to latest version (5.5) my current php version is 5.3.6 bundled with ubuntu 12.04 LTS. The problem is I do not want to upgrade anything else just php but although I specifically tell apt-get the package I'm trying to upgrade it insist on removing mysql 5.1 and installing mysql 5.5 here is the command I'm using:

sudo apt-get --only-upgrade install php5-common

I also tried

sudo apt-get upgrade php5-common

and the response i get is this:

The following extra packages will be installed:
  libalgorithm-diff-xs-perl libapache2-mod-php5 libdbd-mysql-perl libdbi-perl liblocale-gettext-perl libmysqlclient18 libsub-name-perl libterm-readkey-perl libtext-charwidth-perl libtext-iconv-perl mysql-client-5.5
  mysql-client-core-5.5 mysql-common mysql-server mysql-server-5.5 mysql-server-core-5.5 perl perl-base perl-modules php5-cli php5-curl php5-gd php5-mysql php5-pgsql
Suggested packages:
  tinyca mailx perl-doc libterm-readline-gnu-perl libterm-readline-perl-perl php5-suhosin
The following packages will be REMOVED:
  mysql-client-5.1 mysql-client-core-5.1 mysql-server-5.1 mysql-server-core-5.1
The following NEW packages will be installed:
  libmysqlclient18 libterm-readkey-perl mysql-client-5.5 mysql-client-core-5.5 mysql-server-5.5 mysql-server-core-5.5
The following packages will be upgraded:
  libalgorithm-diff-xs-perl libapache2-mod-php5 libdbd-mysql-perl libdbi-perl liblocale-gettext-perl libsub-name-perl libtext-charwidth-perl libtext-iconv-perl mysql-common mysql-server perl perl-base perl-modules php5-cli php5-common
  php5-curl php5-gd php5-mysql php5-pgsql

why is this happening? is php dependant on mysql which would be completely insane. What If I say yes, would apt-get delete my current mysql data while removing it? since this is a running instance I can't risk losing any data (I might take a backup but this means putting the site on maintanence for hours which I don't prefer)

2 Answers 2

1

Problem is that php5-mysql package depends on libmysqlclient18, which depends on mysql-common:

# apt-cache depends php5-mysql
php5-mysql
  Depends: libc6
  Depends: libmysqlclient18
....

# apt-cache depends libmysqlclient18
libmysqlclient18
  Depends: mysql-common
  Depends: libc6
  Depends: zlib1g
  PreDepends: multiarch-support
    multiarch-support:i386
  Replaces: libmysqlclient18:i386
  Breaks: libmysqlclient18:i386

MySQL 5.1 was default in 10.04, while default MySQL version in 12.04 is 5.5, thats why all these packages depend on it indirectly.

If you really don't want to upgrade MySQL, you should find php packages that are linked against MySQL 5.1 - packages built for 10.04 - or you should spin up 10.04 VM and build your own (by rebuilding official ones).

On the other hand, MySQL upgrade shouldn't delete your data. Only 'purge' will do that.

But, just to be on the safe side, what you can do is:

# /etc/init.d/mysql stop
# mv /var/lib/mysql /var/lib/mysql_orig

and then do upgrade. This will install new mysql server and create new /var/lib/mysql with empty database. It won't touch your data because /var/lib/mysql_orig isn't mentioned at all in any mysql-* package definition. After the upgrade, do:

# mv /var/lib/mysql /var/lib/mysql_new_55
# mv /var/lib/mysql_orig /var/lib/mysql
# chown mysql: /var/lib/mysql
# chmod 0700 /var/lib/mysql
# /etc/init.d/mysql start

If you have enough disk space and time, replace mv with cp -ar, so that you have a copy of your MySQL data just in case something goes wrong with the upgrade. Backing up is always a good choice.

After this you will also need to run mysql_upgrade script to upgrade mysql.* tables to 5.5 format.

Also, check for all the differences in config - some of the my.cnf settings has renamed, and some of the defaults has changed.

0
0

Besides just PHP you will also use the following module: php5-mysql. Which requires php common 5.5, which forces the server to update. Try installing php5-mysqlnd instead of php5-mysql.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .