Filed under Web Hosting

Yesterday I decided to upgrade my CentOS4 web server (which hosts TheWebmastersCafe.net) to PHP5 and MySQL5. I just installed Openads 2.3.39-beta a few weeks ago and even though it worked, it was kinda shaky on PHP 4.3.9. Openads recommended at least PHP 4.3.11 but unfortunately, the CentOS4 / RHEL4 RPM was only available up to 4.3.9.

So I decided to get PHP 5.1.6 and MySQL 5.0.46 from the CentOSPlus repository and things went pretty well except for a few glitches. If you have a CentOS4 server and wish to upgrade from PHP4 to PHP5 and from MySQL4 to MySQL5, here’s how to do it:

1. On your server, edit /etc/yum.repos.d/CentOS-Base.repo

2. Set enabled=1 to enable the CentOSPlus repository and save the configuration file.

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever – Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&
      arch=$basearch&repo=centosplus

#baseurl=http://mirror.centos.org/centos/
      $releasever/centosplus/$basearch/

gpgcheck=1
enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4

3. Update YUM.

yum update yum

4. Use YUM to update PHP4 to PHP5.

 yum update php*

The upgrade to MySQL5 will automatically be required by PHP5 so there’s no need to specify it.

5. Install (or update) MySQLClient.

yum install mysqlclient*

6. Edit the PHP configuration file (usually /etc/php.ini) to enable register_long_arrays for backward compatibility. In PHP5 this parameter is set to off by default. If you don’t do this, you won’t be able to use the long predefined arrays ($HTTP_*_VARS).

register_long-arrays=On

7. Restart httpd and mysqld services.

service mysqld restart
service httpd restart

8. Verify that PHP5 is installed.

php -v

I ran into a problem with ProFTPd after upgrading to MySQL5. As ProFTPd authenticated against a MySQL database, it seemed the vftp user couldn’t access the database. I simply granted access to the database through the mysql client:

# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 18765
Server version: 5.0.46 Source distribution

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql> GRANT ALL PRIVILEGES ON [proftpd.database].* TO ‘[proftpd user]‘@’localhost’ WITH GRANT OPTION;
Query OK, 0 rows affected (0.05 sec)

mysql> quit

Then I restarted the proftpd service and everything ran ok.


Related Posts

Comments (1) Posted by Stephane on Sunday, September 9th, 2007


You can follow any responses to this entry through the magic of "RSS 2.0" and leave a trackback from your own site.

One Response to “Upgrading To PHP5 And MySQL5 On CentOS4”

Post A Comment