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 !



    • Related Articles

    • How to Install (Linux, Apache, MariaDB, PHP) LAMP Stack on CentOS 7

      LAMP, which operates Linux as the operating system, is an open-source web-developing platform using Apache as the web-based server and PHP as an object-oriented scripting language. (Instead of PHP, Perl or Python are sometimes used.) Prerequisites ...
    • Install VnStat Network Monitoring on CentOS 7

      Console based network traffic monitoring This article will help you install VnStat network monitoring on your CentOS 7 server. VnStat is console based network traffic monitor for Linux. This will help monitor multiple interfaces at the same time. ...
    • Update PHP 5.4 version to PHP 7.4

      Step 1: Check the version of the php . Command : # php - v  Current version is PHP 5.4  Step 2 : Install Remi Repository and EPEL Repository by using following commands . Commands : # wget ...
    • Install CWP in Centos 7

      CWP is an free and paid license based hosting panel for managing website database,emails,file,etc using a single Panel. In this article we will discuss how to install CWP in Centos 7 Software Requirements You must have a clean/fresh installation of ...
    • How to Install and Configure PowerDNS on centos 7 using MariaDB.

      PowerDNS is a DNS server that works on many derivatives from Linux / Unix. It can be configured with various backends, including zone files of the BIND style, relational databases and failover / load balancing. The DNS recurrent can also be set up as ...