How to Install PHP in CentOS 7

How to Install PHP in CentOS 7

 

PHP is a very popular open-source scripting language that is ideal for web based development. It is executed on the server side and is used in a variety of websites/web based applications. PHP is also an integral part of a LAMP stack, a widely used method to host websites, as it can do things such as process code to display content dynamically and connect to a MySQL database. Unfortunately this wonderful package does not come pre installed on CentOS 7, however with a few commands you can have it up and running in no time. The focus of this article will be to instruct you on how to install PHP on a CentOS 7 based server.

 

Installation Instructions

Before getting started you’ll need to login to your server using SSH. If you’re not familiar with how to do this, or you simply like our articles, please take a moment and read through the following: Connecting to Your Server via SSH. Once you have connected to your server via SSH you may proceed with the installation. You’ll use the Yum package manager to install PHP and the php-mysql package:

 

 

Once the installation process is complete it is advisable to restart the Apache web server so that it can begin working in tandem with PHP. This can be done by issuing the following command:

 

 

That’s it! If you followed the process described above and it completed without any errors, PHP should now be installed and ready to use! You can also install and configure additional PHP modules to extend the functionality of PHP by using our guide: How to install PHP modules (CentOS 7).


Share:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.