How to install PHP 5.5 on CentOS 6 / 5

PHP 5.5 is the latest stable release of PHP programming language. It’s been out for a while and you can start using it without any problems. It is supported by most modern Linux distributions. On this tutorial I will guide you on How to install PHP 5.5 on CentOS

Open a terminal and type “su -” to login as root.
Start downloading the necessary repositories:

Epel & Remi Dependency for CentOS 6

rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

Epel & Remi Dependency for CentOS 5

rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm

For both (CentOS 5 and 6):

Install the PHP core

yum --enablerepo=remi,remi-php55 install php php-common

Install additional common modules:

yum --enablerepo=remi,remi-php55 install php-cli php-gd php-pear php-mysqlnd php-pdo php-pgsql php-pecl-mongo php-sqlite php-pecl-memcached php-pecl-memcache php-mbstrin php-xml php-soap php-mcrypt php-fpm

Restart your web server to apply the changes:

Nginx

service nginx restart

Apache

service httpd restart

Test your PHP version.

Create a phpinfo.php file inside your document root directory, and then load it from your browser as: http://www.yoursite.com/phpinfo. The phpinfo file must contain this code:

<?php
phpinfo();
?>

Other method to check your php version is typing “php -v” from the linux shell as root:

php -v

 

Comments are closed.