In this article, we will outline the process of installing PHP 7.x on CentOS 7 Server.
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
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
Note: The above packages are for general purpose use and may not suit your specific requirements. You should confirm the packages to be installed referring to the Webtatic PHP 7.1 introduction page.
Alternatively, if you want to install PHP 7.0, you should refer to Webtatic PHP 7.0 introduction page.
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
sudo systemctl restart httpd.service
sudo systemctl restart nginx.service php-fpm.service
That's it. Thanks for reading.