Install PHP on centos 7

PHP is a server-side scripting language for web based services. It is frequently used as general-purpose programming language as well. Install PHP on CentOS Minimal Server as.

# yum install php

After installing php, make sure to restart Apache service to render PHP in Web Browser.

# systemctl restart httpd.service

Next, verify PHP by creating following php script in the Apache document root directory.

# echo -e "<?php\nphpinfo();\n?>"  > /var/www/html/phpinfo.php

Now view the PHP file, we just created (phpinfo.php) in Linux Command Line as below.

# php /var/www/html/phpinfo.php
# links
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How can I configure a ip range in CentOS7?

You have to use a range file Edit /etc/sysconfig/network-scripts/ifcfg-enp0s3 and make...

Adding a Public IPv6 Address to a Linux Server (CentOS 7)

To configure an additional public IPv6 address in CentOS 7, proceed as follows:...

How To Install EPEL Repository On CentOS And RHEL 7

How to install EPEL for Centos 7 [root@localhost ~]# cat  /etc/centos-release CentOS Linux...

Common Commands (CentOS 7)

Basic Configuration Query or System Locale...

Install LAMP Stack on CentOS 7

Install LAMP Stack on CentOS 7 One of the most simple and barebones solutions you can have for...