Search Site:

About

Linux

Printers?

Programming

Windows?

Download

Skins

Edit - To Do - AllRecentChanges

Recent Changes Printable View Page History Edit Page

Upgrading Fedora Core 3 with MySQL 4.1 and PHP 5
(with special instructions for Joomla/Mambo users)

About a year ago I built a Linux server using FC3. It's been working fine since and I keep it up-to-date with all the latest packages.

One thing bugged me though: I needed to upgrade the stock MySQL 3.23 database that comes with FC3 to a more modern MySQL 4.1.

The main issue was that there are no Fedora update packages for MySQL 4.1+ as a lot of other packages depend on MySQL 3.23 and upgrading the database would also mean that all those packages -and the packages that depend on them- would also need to be upgraded...
Welcome to dependency hell...

Another issue that ended-up affecting my Joomla web server was that PHP4 relies on a MySQL driver able to connect only to servers of version 4.0 or below, and it would needs to be compiled with a new driver to be able to access MySQL 4.1 and above...

Seemed that the only solution was to get both MySQL and PHP upgraded manually.
The process isn't too difficult and should be pretty smooth, although I recommend that you take careful note of the changes so you can revert them if necessary.

Upgrading MySQL from version 3.23 to 4.1 (or 5)

Preparing the upgrade and saving data

First and foremost, make a backup of all your existing databases.
I use the MySQL Administrator GUI software available for free from the MySQL website. It will complain when connecting to an older database but you should be able to ignore that and still perform a proper backup of your site.

Make also note of the list of users and their passwords for each database. There shouldn't be much problems to get this upgrade going, but if you end-up with access-right issues these configuration details can become handy.

Now, for the database data, you can either try to upgrade it to the new version, in which case you should have a look at the MySQL upgrade pages for migration from 3.23 to 4.0 and 4.0 to 4.1.
One item of note is the fact that ISAM tables are no longer supported by default in MySQL 4.1 and that passwords are saved in a different format.
I personally preferred to backup/restore the database and MySQL user accounts and privileges by hand to avoid having to go through these steps, but feel free to read the links below if you want to do it another way.

Removing old MySQL packages

Now that the backup is done, let's remove MySQL 3.23 from the system:

# service mysql stop
# yum remove mysql-server mysql-devel mysql-client mysql-shared

Make note the packages dependencies that will need to be removed as well. If installed these may include dovecot, the email IMAP server (only useful if you're actually using your Linux box as a POP/IMAP server for your email).
Make note of any configuration file that may be saved to the .rpmsave extension during the removal of the packages, these may need to be re-instated later.

We're also going to make sure that MySQL start with a clean and empty new database:

# mv /usr/lib/mysql /usr/lib/mysql_OLD3.23
# mkdir /usr/lib/mysql
# chown mysql.mysql /usr/lib/mysql

Installing the new MySQL

Now get the MySQL rpm packages from the MySQL download page.
I chose to use the statically linked ones to avoid further dependency issues against libc, but that may not be necessary (it works fine with the static packages though).
So on the download page, go down to Linux x86 generic RPM (statically linked against glibc 2.2.5) downloads section and get the following rpms:

  • Server
  • Client programs
  • Libraries and header files
  • Dynamic client libraries

Install the packages:

# rpm -ivh MySQL*

You may get some syntax error message from the server package but just ignore it.
Just check that the server is up and running and make sure it will start on boot:

# chkconfig --levels 235 mysql on
# service mysql restart

If MySQL cannot restart, make sure that there is no remaining instance of the mysqld or mysqld-safe or anything similar after a service mysql stop has been entered: there could still be zombie processes that could interfere. Reboot if necessary.

Now, once your MySQL database is up and running, enter the following, replacing the etc.nkadesign.com and 123456 by your own hostname and chosen mysql password, obviously...

# /usr/bin/mysqladmin -u root password '123456'
# /usr/bin/mysqladmin -u root -h etc.nkadesign.com password '123456'

Now use the MySQL Administrator software to recreate your users and restore the databases from the backup you made earlier.
If you are having difficulties connecting to the database and get your connections denied, you can have a look at some of the MySQL documentation regarding password and users. I have included some notable pages in the resources section below.

Restoring other packages

the new database should now be working, but we need to re-install the other packages that we removed with MySQL 3.23 to solve dependencies. Some of these packages may be useful to certain applications.
I'm just going to talk about a few here:

  • dovecot mail POP/IMAP server
  • Perl DBI modules
  • php-mysql driver

Other packages should be easily re-installed using yum.

php-mysql driver
Simply don't re-install it. It depends on MySQL 3.23 and will want to re-install that as well as part of its dependencies. If you're using PHP4 and currently have no need to use MySQL from it, you should be fine. Otherwise, you'll have to follow the instructions below to upgrade to PHP5.

Dovecot
Simply do the following to restore functionality:

# yum install dovecot
# cp /etc/dovecot.conf.rpmsave /etc/dovecot.conf
# chkconfig --levels 235 dovecot on
# service dovecot restart

Perl DBI
Use the latest packages from CPAN:

# perl -MCPAN -e shell
cpan> install DBI
cpan> install DBD::mysql

If you get errors reported during the testing phase of installing DBD::mysql, make sure that the test database in MySQL is accessible anonymously.
If you don't want to bother about that and are pretty sure there is no other issue, you can also force installation by using force install DBD::mysql.

MySQL should now be installed an working on your system !

Upgrading PHP from version 4 to 5

Now, as I mentioned before, I had indirect issues with Joomla after my upgrade to MySQL 4.1: PHP needed also to be upgraded to its latest version.
Since there are no package for Fedora Core 3, and that installing the latest Fedora development packages would break a lot of dependencies and have a lot of repercussions, I decided to make both version co-exist.

First, get the latest sources for the following packages:

Then install them:

zlib

# tar xzvf zlib-x.x.x.tar.gz
# cd zlib-x.x.x
# ./configure
# make
# make install
# cd ..

libxml

# tar xzvf libxmll2-x.x.x.tar.gz
# cd libxml2-x.x.x
# ./configure
# make
# make install
# cd ..

PHP 5
The new version of PHP will be installed in its own directory /usr/local/php5. You can of course change that to anything you want.

# mkdir /usr/local/php5
# tar xzvf php-5.x.x.tar.gz
# cd php-5.x.x
# ./configure --prefix=/usr/local/php5  \
   --with-apxs2=/usr/sbin/apxs \
   --with-libxml-dir=/usr/local/lib \
   --with-zlib -with-zlib-dir=/usr/local/lib \
  --with-mysql=/usr \
   --with-mysqli=/usr/bin/mysql_config \
   --with-gd --enable-soap --enable-sockets \
   --with-jpeg-dir=/usr --enable-exif
# make
# make install

Remove/comment-out the following lines that were inserted during PHP install in the /etc/httpd/conf/httpd.conf:

#LoadModule php5_module /usr/lib/httpd/modules/libphp5.so
#AddType application/x-httpd-php .php
 

Move these lines into the more appropriate /etc/httpd/conf.d/php.conf and comment out the reference to the php4 module:

#LoadModule php4_module modules/libphp4.so
LoadModule php5_module /usr/lib/httpd/modules/libphp5.so
AddType application/x-httpd-php .php

Now replace the existing php.ini by a newer version:

# mv /etc/php.ini /etc/php.ini.OLDPHP4
# cp  php-5.x.x/php.ini-recommended /etc/php.ini

You may need to have a look at the content of this file and change some setting. Everything is pretty well explained.

Now, restart your apache web server to ensure that the new php 5 modules are loaded:

# service httpd restart

Normally, everything should be fine.
I use PHP for not only my Joomla website, but also this PmWiki, and others like SquirrelMail and everything runs fine under PHP5.

Joomla specifics

Currently, Joomla 1.0.5 uses by default the old php-mysql interface, which means that, even after successfully upgrading to MySQL 4.1 and PHP 5.1.1, you still won't be able to run Joomla normally.

What needs to be done is simple: replace the current mysql connection scripts with the new, improved ones:

# cd /var/www/html/includes
# mv database.php database.mysql.php
# mv database.mysqli.php database.php

Note the i appended to the improved driver scripts.
Change the path to wherever is your Joomla's install directory.

This should take care of making Joomla use the newly upgraded system.

Resources

Comments
NajmaSaturday 22 June 2013, at 00:11 GMT+8 [X]
Great information This is often sioreupr. Another one checked out specific cheerful and we are baffled. We are attracted to this kind of stories. Sole appreciate your regular attempt, and enjoy your time while in this. Please keep control. These are pretty expensive cri
Enter your comment (no links allowed): Author:

Edit Page - Page History - Printable View - Recent Changes - WikiHelp - Search - RSS -
Page last modified on Tuesday 05 June 2007, at 12:10 GMT+8 - Viewed 4329 times