• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
sharadchhetri

sharadchhetri

Tutorials On Linux, Unix & Open Source

  • Home
  • Linux Commands
  • Resources
    • Learn Linux
  • My WordPress plugins

Install php 5.4 on CentOS 6 with yum command

April 4, 2015 by Sharad Chhetri

In this post we will install php 5.4 on CentOS 6 with yum command . In available default repo of CentOS, we will get the php 5.3 version. Some PHP developers uses the PHP 5.4 version for application, hence we need PHP 5.4 to be installed on CentOS 6.x .

It is known that in CentOS 6 series versions, we can not get the PHP 5.4 version from default yum repo .

To install php 5.4 on CentOS 6.x, we will use the SCL repo. In terms of SoftwareCollections.org (SCL), “Software Collections give you the power to build, install, and use multiple versions of software on the same system, without affecting system-wide installed packages.”

Lets start the installation of PHP 5.4 .

Step 1. Install SCL repo only by hitting below given command.

yum install centos-release-SCL

Step 2. Install php 5.4 version on system now.

yum install php54

To install specific package, package name should be known. Hence, to get the list of available package list from SCL repo run below given command.

yum list|grep php

Step 3. Activate the PHP 5.4 on system.
NOTE: If you run below given command directly from terminal then on next login you will not find PHP 5.4 path.

source /opt/rh/php54/enable

Basically the above command, make PHP 5.4 executable path and environment available to current login user.

To make PHP 5.4 available to all user , we have to add line source /opt/rh/php54/enable inside file called /etc/profile. Now activate without logout by running command.

source /etc/profile

Or in case, if you only want php 5.4 available to specific user then just only edit .bashrc or .bash_profile file from User’s home directory. And add line source /opt/rh/php54/enable .

Step 4. Now check the php version

php -v

Below given is reference from our system.

[root@localhost ~]# php -v
PHP 5.4.16 (cli) (built: Nov 19 2014 08:05:17) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
[root@localhost ~]# 

IMPORTANT NOTE : The PHP 5.4 package actually installed in /opt/rh directory.

Share this:

  • Twitter
  • Facebook
  • More
  • Print
  • Email
  • LinkedIn
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • WhatsApp
  • Mastodon

Related posts:

  1. Install libjpegtran by using yum command in CentOS 6.x
  2. Install MariaDB Server 10 on CentOS 7 and RHEL 7 by using yum
  3. Show visitor ip address php code
  4. php 5.5 APC : ERROR: `make’ failed
  5. PHP Warning: Unknown: Unable to allocate memory for pool. in Unknown on line 0
  6. Installing Nagios-3.5.0 in CentOS 6.4 using yum
  7. Yum command to download rpm file without installing in linux system
  8. PHP Extensions “0” must be loaded Magento
  9. How to hide php version information in header
  10. Increase upload file size limit in php

Filed Under: Linux Tagged With: php

Reader Interactions

Comments

  1. yop says

    January 14, 2016 at 5:43 pm

    First install the SCL repo:

    yum install centos-release-SCL
    Then install PHP 5.4 and these modules:

    yum install php54 php54-php php54-php-gd php54-php-mbstring
    You must also install the updated database module. This installs the new PHP 5.4 module for MySQL/MariaDB:

    yum install php54-php-mysqlnd
    Activate the new PHP version permanently:

    source /opt/rh/php54/enable
    Disable loading the old PHP 5.3 Apache module:

    mv /etc/httpd/conf.d/php.conf /etc/httpd/conf.d/php.conf.old
    You should now have a /etc/httpd/conf.d/php54-php.conf file, which loads the correct PHP 5.4 module for Apache.

    Finally, restart Apache:

    service httpd restart

    • owl says

      August 26, 2016 at 12:11 pm

      Hi, the “php54-php.conf” is not created !
      How to create it from scratch ?
      Regards

    • Sam says

      May 4, 2017 at 9:53 pm

      Fantastic step-by-step instructions. Just follow (carefully) and you are done within a minute or so!
      Thank you

  2. Gordon says

    November 6, 2015 at 10:45 am

    Important note: To install PHP modules you need to use php54-php-(modulename). I was trying to install PDO with yum install php54-pdo but the actual command you need is yum install php54-php-pdo

    There also doesn’t seem to be a module for mcrypt or mssql at all.

Primary Sidebar

Our Social Media Presence

  • Facebook
  • GitHub
  • Twitter

Linux Command

What is Linux Internal And External Command

Linux Basic Commands With Examples For Every Beginner

tr command to convert lines to space , tab and vertical tab

smbpasswd command not found on CentOS 7 and RHEL 7

Solution : semanage command not found

Unix / Linux : How to print duplicate lines from file

More Posts from this Category

You Might Like These Articles!

simplecodesyntax wordpress plugin

SimpleCodeSyntax : My Another WordPress Plugin

Install Nginx

How To Install Nginx On Ubuntu 22.04 LTS

Install Latest Git package in Ubuntu Operating System

How To Always Install Latest Git Package In Ubuntu Operating System

Bash script for installing VirtualBox on Ubuntu 22.04 LTS Desktop

Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)

libfuse

dlopen(): error loading libfuse.so.2 – Got Error On Ubuntu

Failed to open/create the internal network

VirtualBox Error: Failed to open/create the internal network

Always Useful Tips And Tricks

How to find when Operating system was installed in linux CentOS and Red Hat

Could not find make anywhere!!! Please edit the config section to include the path to make. at ./install.pl line 2101

30 useful Linux terminal keyboard shortcuts

How to increase Password Expire date without resetting the password

shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

configure: error: C++ compiler cannot create executables

Print double hyphen sign simultaneously in post of Octopress

Explore 90+ Article On "Linux Tips And Tricks"

Copyright © 2023 ยท
The material in this site cannot be republished either online or offline, without our permission.
Proudly Blogging From Bharat.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy