How to Install PHP 7.x on CentOS 7
How to Install PHP 7.x on CentOS 7
Date posted: 19-oct-2018
In this article, we will installing PHP 7.x on CentOS 7 Server.
Step 1: Setup the Webtatic YUM repo
Precompiled PHP 7.x binaries are available for CentOS 7 from the Webtatic, IUS, or Remi’s RPM repositories.
Below are instructions on installing PHP 7.x using the Webtatic YUM repo.
Setup the Webtatic YUM repo:
sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
Step 2: Install PHP 7.1 and necessary extensions
Install PHP 7.1 and some of the most commonly used extensions:
sudo yum install -y mod_php71w php71w-cli php71w-common php71w-gd php71w-mbstring php71w-mcrypt php71w-mysqlnd php71w-xml
Step 3: configure PHP 7.x
After the installation, the PHP 7.x configuration file will be saved as /etc/php.ini. If necessary, you can use the vi text editor to modify it:
sudo cp /etc/php.ini /etc/php.ini.bak sudo vi /etc/php.ini
Remember to restart your web server after modifying the /etc/php.ini file.
For Apache:
sudo systemctl restart httpd.service