ccurtin
12/9/2016 - 9:34 PM

Upgrading PHP version in a CentOS distro.

Upgrading PHP version in a CentOS distro.

// more info: http://www.shayanderson.com/linux/centos-5-or-centos-6-upgrade-php-to-php-54-or-php-55.htm

// List current versions of php packages. yum list installed | grep php example output:

  php.i686
  php-cli.i686
  php-common.i686
  php-devel.i686
  php-gd.i686
  php-mbstring.i686
  php-mysql.i686
  php-pdo.i686
  php-pecl-xdebug.i686
  php-xml.i686

then remove the installed packages via yum remove PACKAGE_NAME alternative: yum install yum-plugin-replace yum replace php-common --replace-with=php54w-common

Confirm CentOS version: cat /etc/centos-release Add new packages to yum: rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm (for CentOS 6.x)

look to make sure the packages you want are listed and ready to be installed: yum list available | grep php

Run yum install [PACKAGES_NAMES] with the same package that were originally installed

Restart the server: service httpd restart OR sudo apachectl restart

Check the new PHP version is being used in the terminal AND in apache: php -v <?php phpinfo(); ?> in a file and load the page up.