Install LAMP Stack (Linux, Apache, MariaDB, php, phpMyAdmin) on CentOS/RHEL 6 & CentOS/RHEL 7

4) PHP installation

Use the below command to install PHP. PHP initially called Personal Home Page, now it is called asHypertext Preprocessor. PHP is a open source software which is designed for web development purpose. It is used for server-side scripting language as well as general-purpose programming language.

# yum -y install php php-mysql php-gd php-pear

Create test php file to check whether php is working with apache or not.

# nano /var/www/phpinfo.php
<?php phpinfo(); ?>

Restart Apache Service

[Restart apache on RHEL/CentOS 7]
# systemctl restart httpd.service

[Restart apache on RHEL/CentOS 6]
# service httpd restart

Open your web browser and navigate to http://localhost/phpinfo.php or http://your-server-ip-address/phpinfo.php or http://127.0.0.1/phpinfo.php
install-lamp-linux-apache-mysql-php-phpmyadmin-in-centos-image-2

Magesh Maruthamuthu

Love to play with all Linux distribution

You may also like...