How To: Install PHP 5.3 on CentOS 5.1 or RHEL 5.1

PHP 5.2 and PHP 5.3 has tons of functionalities which are not provided by PHP 5.1 and PHP 5.1 is the most recent version of PHP available in CentOS 5.1 and RHEL 5.1 via updates. Also, its difficult for people to upgrade OS(s) on production servers frequently and especially if the servers are running absolutely fine, it doesn’t really make sense to upgrade just for the heck of it. One more reason for no upgrades is the OS choices provided by many hosting companies. But a lot of CMS(s) and softwares are now recommending at least PHP 5.2 for an extended feature set.

I tried a lot of repos for CentOS including RPM Fusion, RPM Forge, EPEL etc., but none of them could provide even PHP 5.2. In some corner of my mind, I had a faint idea of Remi Collet publishing updates about Remi repository. Did a quick google search and found out that PHP 5.3 is actually available in the repository 😀

So, if you are really in need of PHP5.3 on your CentOS/RHEL 5.1 or lesser, head over to Repository Configuration Page and follow the instructions.

Note: The repository is not enabled on install (enabled=0). You need to enable it in /etc/yum.repos.d/remi.repo.

Once installed and enabled, you can update PHP, MySQL from remi repository using the following command

[root@fedora ~]$ yum update php php-* mysql-*

Warning: Drupal is still not totally compatible with PHP5.3 and if you run Drupal sites, be sure to investigate things before upgrading.

 

20 thoughts on “How To: Install PHP 5.3 on CentOS 5.1 or RHEL 5.1

  1. I would suggest the CentOS and RH teams need to wake up. Kind of a major here that the version they provide is 2-3 years old and that more and more programs are in need of a newer version!

  2. Whenever I run yum update php php-* mysql-* I get the following errors, please help!:


    --> Finished Dependency Resolution
    php-ncurses-5.1.6-24.el5_4.5.i386 from installed has depsolving problems
    --> Missing Dependency: php-common = 5.1.6-24.el5_4.5 is needed by package php-ncurses-5.1.6-24.el5_4.5.i386 (installed)
    MySQL-python-1.2.1-1.i386 from installed has depsolving problems
    --> Missing Dependency: libmysqlclient_r.so.15(libmysqlclient_15) is needed by package MySQL-python-1.2.1-1.i386 (installed)
    perl-DBD-MySQL-3.0007-2.el5.i386 from installed has depsolving problems
    --> Missing Dependency: libmysqlclient.so.15(libmysqlclient_15) is needed by package perl-DBD-MySQL-3.0007-2.el5.i386 (installed)
    1:mod_auth_mysql-3.0.0-3.2.el5_3.i386 from installed has depsolving problems
    --> Missing Dependency: libmysqlclient.so.15 is needed by package 1:mod_auth_mysql-3.0.0-3.2.el5_3.i386 (installed)
    MySQL-python-1.2.1-1.i386 from installed has depsolving problems
    --> Missing Dependency: libmysqlclient_r.so.15 is needed by package MySQL-python-1.2.1-1.i386 (installed)
    1:mod_auth_mysql-3.0.0-3.2.el5_3.i386 from installed has depsolving problems
    --> Missing Dependency: libmysqlclient.so.15(libmysqlclient_15) is needed by package 1:mod_auth_mysql-3.0.0-3.2.el5_3.i386 (installed)
    perl-DBD-MySQL-3.0007-2.el5.i386 from installed has depsolving problems
    --> Missing Dependency: libmysqlclient.so.15 is needed by package perl-DBD-MySQL-3.0007-2.el5.i386 (installed)
    Error: Missing Dependency: php-common = 5.1.6-24.el5_4.5 is needed by package php-ncurses-5.1.6-24.el5_4.5.i386 (installed)
    Error: Missing Dependency: libmysqlclient.so.15 is needed by package perl-DBD-MySQL-3.0007-2.el5.i386 (installed)
    Error: Missing Dependency: libmysqlclient.so.15 is needed by package 1:mod_auth_mysql-3.0.0-3.2.el5_3.i386 (installed)
    Error: Missing Dependency: libmysqlclient.so.15(libmysqlclient_15) is needed by package perl-DBD-MySQL-3.0007-2.el5.i386 (installed)
    Error: Missing Dependency: libmysqlclient_r.so.15 is needed by package MySQL-python-1.2.1-1.i386 (installed)
    Error: Missing Dependency: libmysqlclient.so.15(libmysqlclient_15) is needed by package 1:mod_auth_mysql-3.0.0-3.2.el5_3.i386 (installed)
    Error: Missing Dependency: libmysqlclient_r.so.15(libmysqlclient_15) is needed by package MySQL-python-1.2.1-1.i386 (installed)

    What can I do to get php 5.3?

  3. when i type to command prompt “yum –enablerepo=remi install mysql-libs mysql.x86_64 mysql-devel.x86_64 mysql-server php-mysql”

    i saw this errors:

    file /usr/share/mysql/estonian/errmsg.sys from install of mysql-libs-5.1.53-16
    file /usr/share/mysql/french/errmsg.sys from install of mysql-libs-5.1.53-1.e6
    file /usr/share/mysql/german/errmsg.sys from install of mysql-libs-5.1.53-1.e6
    file /usr/share/mysql/greek/errmsg.sys from install of mysql-libs-5.1.53-1.el6
    file /usr/share/mysql/hungarian/errmsg.sys from install of mysql-libs-5.1.53-6
    file /usr/share/mysql/italian/errmsg.sys from install of mysql-libs-5.1.53-1.6
    file /usr/share/mysql/japanese/errmsg.sys from install of mysql-libs-5.1.53-16
    file /usr/share/mysql/korean/errmsg.sys from install of mysql-libs-5.1.53-1.e6
    file /usr/share/mysql/norwegian-ny/errmsg.sys from install of mysql-libs-5.1.6
    file /usr/share/mysql/norwegian/errmsg.sys from install of mysql-libs-5.1.53-6
    file /usr/share/mysql/polish/errmsg.sys from install of mysql-libs-5.1.53-1.e6
    file /usr/share/mysql/portuguese/errmsg.sys from install of mysql-libs-5.1.536
    file /usr/share/mysql/romanian/errmsg.sys from install of mysql-libs-5.1.53-16
    file /usr/share/mysql/russian/errmsg.sys from install of mysql-libs-5.1.53-1.6
    file /usr/share/mysql/serbian/errmsg.sys from install of mysql-libs-5.1.53-1.6
    file /usr/share/mysql/slovak/errmsg.sys from install of mysql-libs-5.1.53-1.e6
    file /usr/share/mysql/spanish/errmsg.sys from install of mysql-libs-5.1.53-1.6
    file /usr/share/mysql/swedish/errmsg.sys from install of mysql-libs-5.1.53-1.6
    file /usr/share/mysql/ukrainian/errmsg.sys from install of mysql-libs-5.1.53-6

    any solutions ?


  4. $ php -v
    $ rpm -qa |grep php
    $ wget http://dev.centos.org/centos/5/CentOS-Testing.repo --output-document=/etc/yum.repos.d/CentOS-Testing.repo
    $ fo0=/etc/yum.repos.d/CentOS-Testing.repo
    $ mv $fo0 $fo0.old
    $ sed 's/enabled=0/enabled=1/g' $fo0.old > $fo0
    $ rm -f $fo0.old
    $ yum remove php*
    $ yum install php53*
    $ rpm -qa |grep php
    $ php -v

    w00t w00t ! 🙂

    1. FYI: Its php53* and causing conflicts with php 5.2 or older if you don’t care to remove one !

      so, better to remove older and get newer one..

      $ yum remove php*
      $ yum install php53*

      via CentOS-Testing repo (:

      1. Great. But how do I get php-mcrypt included on the installation of yum install php53*

        Thanks for the tutorial.

  5. I just did the following and it upgraded my VPS from 5.1.6 to 5.3.3

    I first removed the existing php by the above method specified by Mayur Pipaliya.

    Then I did the following :-

    # wget http://dl.nux.ro/rpm/nux-php53.repo --output-document=/etc/yum.repos.d/php53.repo
    # yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml
    # php -v

    the result was :-
    PHP 5.3.3 (cli) (built: Oct 26 2010 17:09:35)
    Copyright (c) 1997-2010 The PHP Group
    Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

Comments are closed.