• Home
  • Android
    • Apps
      • Android OS Build App
      • Compare Phone Contracts
        • Example 1
        • Example 2
        • Example 3
        • Example 4
        • Example 5
        • Example 6
      • Lump Sum Savings
  • Articles
  • Free Resources
    • Android Graphics Resources For Use In Apps
  • Index

Tekeye's Technology Blog

Upgrade PHP for CentOS 6 Using Additional Repositories

Articles - diana - April 30, 2015

PHP 5.3 to 5.6 Upgrade for CentOS Using External Repos

CentOS Linux is often an option when configuring a Virtual Private Server (VPS). CentOS is designed for stability, being based upon Red Hat Enterprise Linux (RHEL). This means that although it has a long shelf life it may not have the latest features available to the Linux community. To help overcome this other repositories can be used to update the CentOS installation. Here is a list of some alternative repos for CentOS that provided various updated packages:

  • CentOS Additional Repositories
  • Software Collections at SoftwareCollections.org
  • Remi RPM Repository
  • Webtatic Yum Repository
  • Red Hat Software Collections

CentOS PHP UpgradeOne package that may require updating is PHP. CentOS 6 will be supported until 2020 but comes with PHP 5.3, a few point releases behind the current PHP version. In this article the PHP available in CentOS 6 is updated to a later version. This tutorial is based upon a VPS running a minimal installation of the latest version of CentOS 6, the 64 bit version. The tutorial was tested on a Virtual Machine (VM) duplicate of the VPS on a local machine to ensure that the configuration steps correctly worked before applying the upgrade to live environment. Always have a backup of live data and always test upgrades on a duplicate test system. This minimises the risk to a live system.

It is assumed that the VPS is accessed via a Secure Shell (SSH). This method of access can be duplicated on a local test environment to replicate the real world set up. To upgrade PHP log in to the VPS and install an alternative repo, then use yum to install the later PHP version. Here repositories from Les RPM de Remi is used.

This article assumes you are logged in as the root user, if you are logged in as a user with sudo ability use the sudo command where relevant.

Check the PHP Version and Installed Modules on the CentOS VPS

At the shell prompt check the version of PHP in use via the php -v command:

1
2
3
4
# php -v
PHP 5.3.3 (cli) (built: Oct 30 2014 19:56:14)
Copyright (c) 1997–2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998–2010 Zend Technologies

To see which PHP modules are installed it is common to use yum with the list installed option piped to grep:

1
2
3
4
# yum list installed | grep “php”
php.i686 5.3.3–40.el6_6 @updates
php–cli.i686 5.3.3–40.el6_6 @updates
php–common.i686 5.3.3–40.el6_6 @updates

The command yum list installed php\* does the same and lists the repos, alternatively use rpm with -qa:

1
2
3
4
# rpm -qa “php*”
php–cli–5.3.3–40.el6_6.i686
php–common–5.3.3–40.el6_6.i686
php–5.3.3–40.el6_6.i686

Note your system may have additional PHP modules installed.

Remove PHP from the CentOS VPS

PHP 5.3 packages can be deleted, use yum with the remove option (yum remove is identical to the yum erase option). If the Apache HTTP Server is using PHP then HTTP can be stopped using httpd with the -k stop option, or better via the apachectl service script with the stop option. Check the status using service:

1
2
3
4
5
# service httpd status
httpd (pid 17531) is running...
# apachectl stop
# service httpd status
httpd is dead

Remove the PHP 5.3 modules using yum remove followed by the list of modules. If installed via groups use the groupremove option. To see the if the “PHP Support” group is installed also pass “php*”:

1
2
3
4
5
# yum grouplist “php*”
Installed Groups:
PHP Support
# yum groupremove “PHP Support”

You will need to confirm the removal with y. This may not remove dependant packages, use yum remove.

1
# yum remove php-common php-cli

Again y to confirm removal. Similarly if not installed via groups using yum to remove all modules listed:

1
# yum remove php php-common php-cli

Install PHP 5.6 on CentOS 6 Using Remi Repositories

The website Les RPM de Remi has a releases of PHP 5.5 and PHP 5.6 available in repositories. There is detailed configuration available on the website. Here the steps to configure it for CentOS 6 are shown. Important, ensure the software using PHP on the server works with the newer version of PHP. If in doubt check with the software supplier.

Start by grabbing a couple of RPMs. This is done using the wget utility. For this tutorial the root’s home directory was used, a suitable temporary location is sufficient, the URL isn’t too long:

1
# wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

And

1
# wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

Then run the package manager:

1
# rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm

Now use yum to replace the default PHP 5.3 or install PHP 5.6, enabling these new repositories:

Update (if you did not remove PHP 5.3):

1
# yum –enablerepo=remi,remi-php56 update php\*

Or install PHP 5.6:

1
# yum –enablerepo=remi,remi-php56 install php

You will need to confirm the action. Your installation may require other PHP modules. Check the install using php -v:

1
2
3
4
# php -v
PHP 5.6.8 (cli) (built: Apr 16 2015 14:47:38)
Copyright (c) 1997–2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998–2015 Zend Technologies

Next start or restart Apache:

1
# apachectl start

Or:

1
#apachectl restart

Check that any website or software hosted by the VPS is working correctly.

CentOS PHP Upgraded to PHP 5.6

Related posts:

  1. CentOS 6 to CentOS 7 Upgrade Using Red Hat Upgrade Tool
  2. Unzip File on VPS? How to Extract a Zip File on a Linux VPS
  3. PHP on Windows Using WebMatrix Single Click Install
  4. Show PHP Settings with phpinfo and Example PHP $_SERVER Display Page
 0 0

Share This Post!

About Author / diana

No Comment

Leave a Reply Cancel Reply

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

Previous Post
Next Post

About Me

Thanks for visits my website, hope you like my posts

Recent Posts

  • Blogging Guide – Start a Blog in 3 Easy Steps
  • This Changes Everything
  • How to make a website
  • How to Make a Weebly Website
  • Why Some Webcomics (and Some Web Businesses) Are Successful
  • Hostmonster Coupon Code and Discount Offer 2021
  • Frugal Tips for a Freelance Web Designer
  • Affiliate Millions: Make a Fortune using Search Marketing on Google and Beyond
  • Surefire SEO For New Websites
  • SEO – Using Bait to Attract Website Visitors
  • WEBSITE DESIGN TIPS
  • Xbox 360 Flashing
  • 12 best tools productivity business
  • Top android security apps available on market
  • How to View Instagram Private Accounts [2021 Guides]

Archives

  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • January 2016
  • June 2015
  • April 2015
  • March 2015
  • February 2015
  • January 2015

Widget Area 1

Assign a Widget

Widget Area 2

Assign a Widget

Widget Area 3

Assign a Widget

Alison is a creative soft blog theme made with by angrygorilla.