Installing PHP7 on Linux CentOS is a common task, especially for web developers. This article will guide you through the steps to successfully install PHP7 on your system.
First, log in to your Linux CentOS server as a root user or a user with sudo privileges.
Before starting the installation, update your system to ensure that all software packages and security patches are up to date. Run the following command to update your system:
<span class="fun">sudo yum update</span>
The EPEL (Extra Packages for Enterprise Linux) repository contains additional software packages, including the PHP7 installation package. Install the EPEL repository with the following command:
<span class="fun">sudo yum install epel-release</span>
The Remi repository provides PHP7 packages. After installing the EPEL repository, you need to install the Remi repository. Run the following command:
<span class="fun">sudo yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm</span>
Once the Remi repository is installed, enable the PHP7 package from it by running the following command:
<span class="fun">sudo yum-config-manager --enable remi-php70</span>
You can now install PHP7 along with commonly used components such as PHP-CLI, PHP-OPcache, PHP-Mysql, etc. Run the following command:
<span class="fun">sudo yum install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysql</span>
After installation, you can verify the PHP version by running the following command:
<span class="fun">php -v</span>
If the output shows the PHP version, it means PHP7 has been successfully installed on your CentOS system.
By following the above steps, you should be able to install PHP7 and its associated components successfully on CentOS. If you follow these steps carefully, you can avoid common installation issues. Good luck with your installation!