How to Install PHP in CentOS 7

How to Install PHP in CentOS 7

PHP is the part of our setup that processes code for dynamic content display. It can run scripts, link to our MySQL databases, and view processed content to our web server.


Step 1: We can use the following command for the installation of our components. The php-mysql kit will also be included:

 

Command : # yum install php php-mysql


 


Step 2: PHP should be built problem-free. To function with PHP we have to restart the Apache web server

 

Command : # systemctl restart httpd


Step 3: We can install the php modules by the following command

 

Command : # yum install php-fpm


Step 4: We can test the php using the test page. We will edit create a php file at given location:


Command : # vi /var/www/html/info.php


Now copy the content as given below in the file and save the file by :wq

<?php phpinfo(); ?>




Step 5 : We can access the page by following url:


http://your_server_ip/info.php





THANK YOU !