Upgrade PHP to PHP 7

From Tech Wiki
Jump to navigation Jump to search

To upgrade PHP to PHP 7.0 on CentOS 7 use the following commands:

First of all you need to add the correct repositories:

wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh epel-release-latest-7.noarch.rpm
rpm -Uvh remi-release-7.rpm

To see which PHP Modules you currently have installed use the following command:

php -m

Then use the following commands to remove the old PHP installations and re-add them:

yum remove php*

yum install php --enablerepo=remi-php70

To install the PHP Modules that where listed using the php -m command you can use the yum install php --enablerepo=remi-php70 command but insert the modules you would like to install as so:

yum install php php-cli php-common php-devel php-fpm php-gd php-ldap php-mbstring php-mcrypt php-mysql php-odbc php-pdo php-pear sql php-process php-soap php-xml php-zip php-intl php-curl php-openssl php-xsl --enablerepo=remi-php70