How to Install PHP on CentOS 7

How to Install PHP on CentOS 7
How to Install PHP on CentOS 7

Install PHP on CentOS 7

PHP is one of the most popular programming language currently in the world. PHP has different versions 5.6, 7.0, 7.1 and 7.2. CentOS 7 is the current latest version of CentOS. This tutorial outlines how to install PHP on CentOS 7.

Prerequisites

Before you start installing PHP on CentOS 7. You must have a non-root user account on your server with sudo privileges.

How to Install PHP 7.0 on CentOS 7

First, enable remirepoby using following command:

sudo yum-config-manager --enable remi-php70

Run the following command to install PHP on your server. The following command will install php70.

sudo yum install php70

Check PHP version and confirm the installation by running following command

php -v

Following are some basic PHP extensions needs to be installed on your server

sudo yum install php70-php-fpm php70-php-mysqlnd php70-php-opcache php70-php-xml php70-php-xmlrpc php70-php-gd php70-php-mbstring php70-php-json

How to Install PHP 7.2 on CentOS 7

First, enable remirepoby using following command:

sudo yum-config-manager --enable remi-php72

Run the following command to install PHP on your server. The following command will install php7.2.

sudo yum install php72

Check PHP version and confirm the installation by running following command

php -v

Following are some basic PHP extensions needs to be installed on your server

sudo yum install php72 php72-php-fpm php72-php-mysqlnd php72-php-opcache php72-php-xml php72-php-xmlrpc php72-php-gd php72-php-mbstring php72-php-json

Conclusion

In this tutorial, you have learned how to install PHP on CentOS 7 successfully with some of its basic extensions useful for frameworks and tested successfully. If you have any of the queries regarding this then you can comment below.

LEAVE A REPLY

Please enter your comment!
Please enter your name here