Install PHP 5.5 – CentOS/RHEL 7.2, 6.8 and 5.11 (Yum)


To totally unlock this section you need to Log-in


Login

PHP 5.5.37 has been released on PHP.net on 23rd June 2016, and is also available for CentOS/RHEL 5.11, 6.8 and 7.2 at Webtatic via yum.

PHP 5.5 adds new features such as:

  • Zend Optimizer+ opcode cache included, now known as opcache extension.
  • Generators
  • try { } finally { }
  • Literal dereferencing for arrays and strings.
  • Array return value de-referencing.
  • Class name resolution.
  • Password hashing API.

To install, first you must add the Webtatic EL yum repository information corresponding to your CentOS/RHEL version to yum:

CentOS/RHEL 7.x

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

CentOS/RHEL 6.x

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

CentOS/RHEL 5.x

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-5.noarch.rpm
rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpm

Now you can install PHP 5.5’s mod_php SAPI (along with an opcode cache) by doing:

yum install php55w php55w-opcache

You can alternatively install PHP 5.5’s php-fpm SAPI (along with an opcode cache by doing:

yum install php55w-fpm php55w-opcache

See the package list below for additional SAPIs and PHP extensions.

If you would like to upgrade php to this version it is recommended that you first check that your system will support the upgrade, e.g. making sure any CPanel-like software can run after the upgrade.

Install PHP 5.5 - CentOS/RHEL 7.2, 6.8 and 5.11 (Yum)

Unless you know what you are doing, it is risky upgrading an existing system. It’s much safer to do this by provisioning a separate server to perform the upgrade as a fresh install instead.

If you know what you are doing, you can upgrade PHP by:

yum install yum-plugin-replace

yum replace php-common --replace-with=php55w-common

It will likely give you a message “WARNING: Unable to resolve all providers …”. This is normal, and you can continue by tying “y“. You will be given a chance to see what packages will be installed and removed before again being given a chance to confirm.

SAPIs – different runtime environments of PHP

mod_php NTS

(non-thread safety) Contained in the php55w package, this SAPI integrates into Apache Httpd (2.2.* on RHEL/CentOS 6, 2.4.* on RHEL/CentOS 7). It is the standard SAPI for use with httpd prefork mpm (the default mode httpd is ran under. It is not thread-safe, but doesn’t need to be due to prefork not using threads. It’s located at /usr/lib[64]/httpd/modules/libphp5.so.

cli

Contained in the php55w-cli package, this SAPI allows running scripts from the command-line, and also has a built-in web server for development-use. Located at /usr/bin/php.

fpm

Contained in the php55w-fpm package, fpm (FastCGI Process Manager) is a scalable FastCGI process, which acts similar to how Httpd prefork mpm works managing it’s forks. Located at /usr/sbin/php-fpm, it is controlled using the /etc/init.d/php-fpm service script on RHEL/CentOS 5/6, or the php-fpm.service Systemd unit on RHEL/CentOS 7.

embedded

Contained in the php55w-embedded package, this SAPI allows embedding PHP in other applications. It’s library is located at /usr/lib[64]/libphp5.so.

cgi, fastcgi

Contained in the php55w-cli package, these SAPIs are not recommended for use, but are available where needed. They both exist in the binary at /usr/bin/php-cgi.

mod_php TS

(thread safety) Contained in the php55w package, this SAPI integrates into Apache Httpd (2.2.* on RHEL/CentOS 6, 2.4.* on RHEL/CentOS 7). It is the standard SAPI for use with httpd worker mpm. It’s supposed to be thread-safe, but can’t guarantee to be, and certainly not under additional PHP extensions. It’s better to use FastCGI SAPIs than this one. It’s located at /usr/lib[64]/httpd/modules/libphp5-zts.so.

PackageProvides
php55wmod_php, php55w-zts
php55w-bcmath
php55w-cliphp-cgi, php-pcntl, php-readline
php55w-commonphp-api, php-bz2, php-calendar, php-ctype, php-curl, php-date, php-exif, php-fileinfo, php-ftp, php-gettext, php-gmp, php-hash, php-iconv, php-json, php-libxml, php-openssl, php-pcre, php-pecl-Fileinfo, php-pecl-phar, php-pecl-zip, php-reflection, php-session, php-shmop, php-simplexml, php-sockets, php-spl, php-tokenizer, php-zend-abi, php-zip, php-zlib
php55w-dba
php55w-devel
php55w-embeddedphp-embedded-devel
php55w-enchant
php55w-fpm
php55w-gd
php55w-imap
php55w-interbasephp_database, php-firebird
php55w-intl
php55w-ldap
php55w-mbstring
php55w-mcrypt
php55w-mssql
php55w-mysqlphp-mysqli, php_database
php55w-mysqlndphp-mysqli, php_database
php55w-odbcphp-pdo_odbc, php_database
php55w-opcachephp55w-pecl-zendopcache
php55w-pdo
php55w-pecl-gearman
php55w-pecl-geoip
php55w-pecl-memcache
php55w-pecl-xdebug
php55w-pgsqlphp-pdo_pgsql, php_database
php55w-processphp-posix, php-sysvmsg, php-sysvsem, php-sysvshm
php55w-pspell
php55w-recode
php55w-snmp
php55w-soap
php55w-tidy
php55w-xmlphp-dom, php-domxml, php-wddx, php-xsl
php55w-xmlrpc