PHP ( hypertext preprocessor) is a widely used scripting language for web development. It is also an open source scripting language. Current version of PHP is 7.0 It was originally created by Rasmus Lerdorf in 1994.

The file extension is .php and the path of php file stored at location /var/www/html/test.php

For php there must be web server installed on your system e.g Apache or nginx etc.

Packages required

  1. Php
  2. Php-mysql # mysql Server , you can any other database server
  3. Php-gd
  4. Php-pear

Php-gd = A module for PHP applications for using the gd graphics library

Php-pear = PHP Extension and Application Repository framework

Other Packages are mentioned below you can install them according to your need

  1. OPcache (php-opcache)
  2. APCu (php-pecl-apcu)
  3. CLI (php-cli)
  4. PDO (php-pdo)
  5. PostgreSQL (php-pgsql)
  6. MongoDB (php-pecl-mongodb)
  7. Redis (php-pecl-redis)
  8. Memcache (php-pecl-memcache)
  9. MCrypt (php-mcrypt)
  10. XML (php-xml)

Step 1: Install PHP using Yum

Note : Must  have web server installed on machine

yum install php php-mysql.x86_64 php-gd.x86_64 php-pear.noarch  –y

Step 2: Now create a test file under the directory /var/www/html/test.php

Put these line in the file test.php




And save the file

Step 3: Now restart the apache server service

Systemctl restart httpd

Now go to the browser type replace IP with your or run on localhost http://localhost/test.php

You will see this page if php is successfully installed and working.

You’re done



Please enter your comment!
Please enter your name here

17 − nine =