July 25, 2014

Installing PHP 5.3 on CentOS 5.7

The assumption for installing PHP 5.3 on CentOS 5.7 tutorial is that you are running as root and have a basic understanding of the software required but if you follow this tutorial you should be able to complete the task successfully.

Install Yum Priorities

For a brief overview on and how to configure Yum Priorities you can follow the instructions outlined in our Install YUM Priorities on CentOS tutorial.

# yum install yum-priorities

Installing PHP 5.3 on CentOS 5.7 x86_64

Install the EPEL x86_64 YUM Repository

# rpm -Uvh http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

Install the IUS x86_64 YUM Repository

# rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/ius-release-1.0-10.ius.el5.noarch.rpm

# yum install php53u php53u-common php53u-devel

# php -v
PHP 5.3.8 (cli) (built: Aug 23 2011 06:33:32)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies

Installing PHP 5.3 on CentOS 5.7 i386

Install the EPEL i386 YUM Repository

# rpm -Uvh http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

Install the IUS i386 YUM Repository

# rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/ius-release-1.0-10.ius.el5.noarch.rpm

# yum install php53u php53u-common php53u-devel

# php -v
PHP 5.3.8 (cli) (built: Aug 23 2011 06:33:32)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies

  • Ccastrogustavo

    Error dependencies
    [root@oficina ~]# yum install yum-priorities
    Loaded plugins: fastestmirror, priorities
    Loading mirror speeds from cached hostfile
     * Webmin: webmin.mirror.somersettechsolutions.co.uk
     * base: http://ftp.ciril.fr
     * epel: http://ftp.rediris.es
     * extras: http://ftp.ciril.fr
     * ius: http://ftp.rediris.es
     * updates: http://ftp.ciril.fr
    epel                                                                                                                                                                                                                  | 3.7 kB     00:00
    ius                                                                                                                                                                                                                   | 2.2 kB     00:00
    Setting up Install Process
    Package yum-priorities-1.1.16-16.el5.centos.noarch already installed and latest version
    Nothing to do
    [root@oficina ~]# yum install php53u php53u-common php53u-devel
    Loaded plugins: fastestmirror, priorities
    Loading mirror speeds from cached hostfile
     * Webmin: webmin.mirror.somersettechsolutions.co.uk
     * base: http://ftp.ciril.fr
     * epel: http://ftp.rediris.es
     * extras: http://ftp.ciril.fr
     * ius: http://ftp.rediris.es
     * updates: http://ftp.ciril.fr
    Setting up Install Process
    Resolving Dependencies
    –> Running transaction check
    —> Package php53u.i386 0:5.3.8-2.ius.el5 set to be updated
    –> Processing Dependency: php53u-cli = 5.3.8-2.ius.el5 for package: php53u
    –> Processing Dependency: libtool-ltdl for package: php53u
    –> Processing Dependency: t1lib for package: php53u
    –> Processing Dependency: libedit for package: php53u
    —> Package php53u-common.i386 0:5.3.8-2.ius.el5 set to be updated
    —> Package php53u-devel.i386 0:5.3.8-2.ius.el5 set to be updated
    –> Running transaction check
    —> Package libedit.i386 0:2.11-2.20080712cvs.el5 set to be updated
    —> Package libtool-ltdl.i386 0:1.5.22-7.el5_4 set to be updated
    —> Package php53u-cli.i386 0:5.3.8-2.ius.el5 set to be updated
    —> Package t1lib.i386 0:5.1.1-7.el5 set to be updated
    –> Processing Conflict: php53u conflicts php Finished Dependency Resolution
    php53u-5.3.8-2.ius.el5.i386 from ius has depsolving problems
      –> php53u conflicts with php
    Error: php53u conflicts with php
     You could try using –skip-broken to work around the problem
     You could try running: package-cleanup –problems
                            package-cleanup –dupes
                            rpm -Va –nofiles –nodigest
    The program package-cleanup is found in the yum-utils package.

  • Anonymous

    Before you install…

    # yum remove php*

  • Onyy_ypdg

    thank you very much it’s working great for me i use centos 5.7 I386 but you have to run the following update to working great with Mysql  # yum -y install php53u-mysql

    Thanks again

  • Ccastrogustavo

    Yes 
    yum remove php

    yum install  …..

    thanks.

  • Onyy_ypdg

    I use Ispconfig3 on centos 5.7 the best way to upgrade php5.2.1 to php5.3.8 is this tutorial but you should to do it the following command to lit squirelmail and other service works great 

    yum install php53u-imap php53u-ldap php53u-mbstring php53u-mcrypt php53u-mhash php53u-mssql php53u-mysql php53u-odbc php53u-pdo php53u-snmp php53u-soap php53u-tidy php53u-xml php53u-xmlrpc phpmyadmin

    One last thing we need to do is modify the file /etc/squirrelmail/config_local.php and comment out the $default_folder_prefix variable – if you don’t do this, you will see the following error message in SquirrelMail after you’ve logged in: Query: CREATE “Sent” Reason Given: Invalid mailbox name.
    vi /etc/squirrelmail/config_local.php
    and put // like below 
    //$default_folder_prefix = ”;
    thin everything will working great in ISPconfg3
    thanks again for this tutorial 

  • Bo

    Setting up Install Process
    No package php53u available.
    Nothing to do

    Suggestions?

  • Anthony Goodge

    I’m a newbie to the world of Linux/PHP and I’m trying to upgrade PHP onn my CentOS 5.7 server.

    I’m currently on PHP 5.1.6 and my web developer have asked for PHP 5.3 – following the above instructions shows PHP5.3 available but flags the error the it conflicts with the current version.

    If I run “yum remove php” it lists 128 dependencies (i can list if you want)

    my question is … am I likely to break things if I remove 5.1.6 and then install 5.3

  • Anthony C

    I’m in a similar position, Anthony. I’ve just installed a fresh CentOS 5.7 x64 for web dev and it had 5.1.6 installed as standard. I did as previously suggested and did a yum remove php* and then tried to install PHP5.3 as per Onyy_ypdg’s instructions. It didn’t work (errors when doing a php -v) so I removed all php* again (with apache stopped) and tried the install from the main article.  Now, php -v says I have php 5.3.9 installed. I just need to dig through the config now to find out where it’s pointing to for the document root now, as it’s not pointing to the default /var/www/html as it was previously

  • Anonymous

    Rather late than never.

    Always make sure you have a backup before upgrading production systems. We’ve had no problems with the upgrade but every installation is different

  • Anonymous

    Document root is in /etc/httpd/conf/httpd.conf

    DocumentRoot “/var/www/html”

  • Ryan Graff

    # yum remove php*
    For those of you who don’t care what the package used to be called ;)

  • Jharrison

    The instruction:

    rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

    is not accurate any more. Use:

    rpm -Uvh http://fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

  • Jharrison
  • How2CentOS

     Thanks! I have updated the instructions to reflect your change

  • http://www.mmo-symposium.com rsmarsha

    I found that you have to use dl.fedoraproject.org now for the first EPEL link

  • rasvan

    Superb tutorial thanks a lot, saved a n00b like me tons of time.