How To Update PHP on Servers (Centos/Fedora/RHEL)

on March 3 | in Hosting / Servers, Linux | by | with 14 Comments

In this howto i will describe how to update PHP rpms on servers to latest version. If you have server running CentOS/Fedora/RHEL, you will noticed that it will use regular rpms of distro to install PHP and to update you have to restrict yourself with distro update of said rpms of PHP, which can be not a major update.

Like in CentOS 5.3 you cannot update PHP version above 5.1.x. I have been using different repositories to update PHP to latest version but most of them break rpm one or two, which may let to unstable Server.

AtomicRocketTurtle (http://www.atomicrocketturtle.com/) company i found that regularly updating applications used in CentOS/Fedora/RHEL. You will be seeing that i will be updating PHP from version 5.1.x to 5.2.12, which is latest till this date.

1) Install AtomicRocketTurtle Repository.

Pre-requisite of atomicrocketturtle repository is yum, you should be confirm that you have yum install specially on CentOS. Some of the VPS comes without yum installation, so if your server doesnt have yum on CentOS 5.x, use following my post to install yum. http://www.sohailriaz.com/howto-install-yum-on-centos-52-vps/

To install atomicrocketturtle repository run following command.

wget -q -O – http://www.atomicorp.com/installers/atomic.sh | sh

This script will automatically detect your OS and install approperiate repository.

2) Update PHP

First check the available PHP version on atomic repository

yum list | grep atomic | grep php

Get the list of your install rpm and update following.

rpm -qa | grep php
php-cli-5.1.6-23.2.el5_3
php-5.1.6-23.2.el5_3
php-gd-5.1.6-23.2.el5_3
php-pdo-5.1.6-23.2.el5_3
php-common-5.1.6-23.2.el5_3
php-imap-5.1.6-23.2.el5_3
php-xml-5.1.6-23.2.el5_3
php-mbstring-5.1.6-23.2.el5_3
php-mysql-5.1.6-23.2.el5_3

It can be different for you, just create the list like below i used for update PHP. I used every package name as i dont want to miss any of the module it has.

yum update php php-cli php-gd php-pdo php-common php-imap php-xml php-mbstring php-mysql

at end you will see this

Updated: php.i386 0:5.2.12-3.el5.art php-cli.i386 0:5.2.12-3.el5.art php-common.i386 0:5.2.12-3.el5.art php-gd.i386 0:5.2.12-3.el5.art php-imap.i386 0:5.2.12-3.el5.art php-mbstring.i386 0:5.2.12-3.el5.art php-mysql.i386 0:5.2.12-3.el5.art php-pdo.i386 0:5.2.12-3.el5.art php-xml.i386 0:5.2.12-3.el5.art
Complete!

If you have any question please use comments.

pixelstats trackingpixel
Pin It

related posts

14 Responses to How To Update PHP on Servers (Centos/Fedora/RHEL)

  1. Jun says:

    this works.. thanks

  2. when i run yum update …….
    after testing it shows me some conflicts.

    Transaction Check Error:
    file /etc/my.cnf from install of mysql-libs-5.5.19-1.el5.remi.i386 conflicts with file from package mysql-5.0.77-4.el5_5.4.i386
    file /usr/share/mysql/charsets/Index.xml from install of mysql-libs-5.5.19-1.el5.remi.i386 conflicts with file from package mysql-5.0.77-4.el5_5.4.i386
    file /usr/share/mysql/charsets/cp1250.xml from install of mysql-libs-5.5.19-1.el5.remi.i386 conflicts with file from package mysql-5.0.77-4.el5_5.4.i386
    file /usr/share/mysql/charsets/cp1251.xml from install of mysql-libs-5.5.19-1.el5.remi.i386 conflicts with file from package mysql-5.0.77-4.el5_5.4.i386

    suggest me how to remove these conflicts,

  3. @Yaqoob: Did you manage to fix it. If not then detail of the issue is that its comes within the repository because sometime they added some packages which are dependent on some latest or old version which havent update in repository.
    to fix this you have to manually install or remove rpm.

    In your case it try to install mysql from other source which is out of CentOS Repository. You gotta do this manually by not let it update mysql.

    ———
    Regards,

  4. Bebop says:

    I need to update my php from 5.1.6 to 5.2. I don’t need the absolute latest version.

    Is there a chance you can talk me through it. I have no server experience really…but I have putty..and a basic knowledge.

    Thanks

    B

  5. @Bebop: Using above procedure will not let you install specific PHP version unless it is available same on repository. All you can do is to find and download all rpms for 5.2.x and install them at one command. You can find you list of already install rpm using following command.

    rpm -qa | grep php

    get the names of all install php rpm and search it on internet. I am sure somebody has full list available for 5.2. Download them on one location and install with one rpm install command.

    ——–
    Regards,

  6. Bebop says:

    Thank you for your help and for responding so quickly.

  7. Mohammad says:

    Nice!
    It`s so useful!

  8. Henry says:

    Where did you go to university? buy zoloft online
    39. Pursue life-long learning and professional development through self-analysis

  9. sohail shahzad says:

    Really Nice Work

  10. Hadi Ubaidillah says:

    in my fedora i use
    “yum update php”

    and its work perfect…

  11. […] Post Title : How to update php on servers (centos/fedora/rhel) | sohail Source : http://www.sohailriaz.com Read More : How to update php on servers (centos/fedora/rhel) | sohail […]

  12. […] Post Title : How to update php on servers (centos/fedora/rhel) | sohail Source : http://www.sohailriaz.com Read More : How to update php on servers (centos/fedora/rhel) | sohail […]

Leave a Reply

Your email address will not be published. Required fields are marked *

« »