Install PHP 5 in Red Hat Enterprise Linux 5

Q. I saw your earlier article about how to install PHP 5 under Red Hat Enterprise Linux version 4. But I’m using Red Hat enterprise Linux 5 and I don’t want to mess up with old version instructions. Is there a way that I can install PHP5 under RHEL 5 without using source rpm?

A. Redhat Enterprise 5 supports PHP version 5 out of box. You can install PHP 5 using any one of the following method:

Method #1: Download and install php 5 from RHN

Type the following command to install php 5:
# yum install php
You may also want to install Apache and other php 5 extensions:
# yum install httpd php-gd php-mysql

Method #2: CD/DVD

Mount CD/DVD rom and use rpm command to install PHP5:
# rpm -ivh php*

Method #3: Use GUI package manager

Type the following command to start GUI package manager:
# system-config-package
Now Select PHP (under Web Servers) and install the same.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 8 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
8 comments… add one
  • keimoto Jul 10, 2007 @ 0:43

    Would method #2 a bit overkill?

  • 🐧 nixCraft Jul 10, 2007 @ 14:47


    May be as it installs almost all php modules. If you just want php-mysql and gd, try

    rpm -ivh php-mysql* php-gd*


  • allangering Nov 18, 2009 @ 13:13

    I’m tearing my hair out trying to get PHP 5.2.6 installed on our RHEL 5 box here. Upgrading to RHEL 5 is an option down the road, but not tonight, which is when we need to get this instance of our webapp that depends on a new build of PHP running.

  • Rudi Mar 18, 2010 @ 7:42

    You can get Php 5.2.* from Redhat. If you PAY for their Advanced Application stack. 1 Year basic support = $1,999 or if you want Premium Support for 1 year = $8,499.

    Redhat are becoming worse than Microsoft. At least MS don’t give you outdated software versions if you pay them less money.

  • Ben Dec 20, 2010 @ 20:30

    haha…Redhat is a joke…RPM actually give you a binary package, which is not tuned for your machine, and you have no option to compile your own, e.g. in apache, you might want to choose MPM=event or worker. or you wanna compile all modules as static modules.

    Of course you can install from source, but it will cause you difficult to manage all your packages, especially RedHat always give you outdated packages.

    I’ve switched to FreeBSD from RedHat already. I am happy I don’t need to pay Redhat for this kind of service.

  • Jerome Benton Mar 2, 2011 @ 17:17

    Does PHP 5 work on Red Hat Enterprise Linux version 6?

    • al biheiri Apr 21, 2011 @ 14:33

      rhel6 comes with php 5.3.2

  • ratheesh Jun 20, 2011 @ 10:38

    i want php 5.2 + for redhat5 32 bit rpm packge …………. is it available ? pls give the detils……….

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum