How to Install PHP on CentOS

Introduction

PHP is a server-side scripting language. Originally it was designed for web development but it can also be used as a general-purpose language. It was created by Rasmus Lerdorf in 1994. Originally it stood for Personal home page but now it stands for Hyper Text Preprocessor. PHP code can be embedded into HTML. PHP is basically an interpreted language implemented by a web server or CGI executable. In this tutorial, we will learn the steps to install PHP on CentOS.

Prerequisites

  • CentOS 7
  • Login as an administrator on the terminal
  • Yum must be configured on the system.
  • ius-release repository must be present.

Installation

Installation includes following steps.

1. Check PHP

Just type php on the terminal to check whether PHP is present on the system. In my case, it is not present.

2. Install PHP

Installing php on centos7 needs ius-release repository which can be installed by executing the following command.

Once, the installation of ius-release is completed, we can simply install PHP version 7.1 by executing following command.

CentOS How to Install PHP on CentOS CentOS How to Install PHP on CentOS1

3. Verify PHP

We can check whether PHP has been successfully installed on the system or not by checking the version of php. Execute the following command to do so.

CentOS How to Install PHP on CentOS2

Hence, we have installed and get started with PHP on CentOS.


Next TopicInstall Python




Latest Courses