• Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us
TecAdmin
Menu
  • Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us

How to Install PHP on CentOS 8

Written by Rahul, Updated on November 27, 2019
General Articles CentOS 8, PHP

This tutorial will help you to install PHP on CentOS 8 and RHEL 8 Linux systems. PHP 7.3 is the latest stable version available for installation and PHP 7.4 is in the release cycle.

Setup Yum Repository

For this tutorial, we will use the REMI repository for PHP installation on CentOS 8 Linux system. So add the REMI repository on your system using the following command.

sudo dnf install dnf-utils http://rpms.remirepo.net/enterprise/remi-release-8.rpm

REMI repository contains the PHP packages. You just need to enable the correct repo for the required PHP version. Find out the available repository for the different PHP versions.

sudo dnf module list php

Last metadata expiration check: 0:33:48 ago on Wed 23 Nov 2019 08:12:31 PM PST.
CentOS-8 - AppStream
Name      Stream             Profiles                          Summary
php       7.2 [d]            common [d], devel, minimal        PHP scripting language

Remi's Modular repository for Enterprise Linux 8 - x86_64
Name      Stream             Profiles                          Summary
php       remi-7.2           common [d], devel, minimal        PHP scripting language
php       remi-7.3 [e]       common [d] [i], devel, minimal    PHP scripting language
php       remi-7.4           common [d], devel, minimal        PHP scripting language

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

The above output shows that the default AppStream contains PHP 7.2 and REMI contains PHP 7.2, 7.3 and 7.4 packages. Let’s start with the PHP installation.

Install PHP on CentOS 8

At this point, your system is ready for PHP installation. PHP 7.4 is still under development, so we don’t recommend to use for production servers. But still, you can use this on your development systems.

Install PHP 7.4

sudo dnf module reset php
sudo dnf module enable php:remi-7.4
sudo dnf install php

Install PHP 7.3

sudo dnf module reset php
sudo dnf module enable php:remi-7.3
sudo dnf install php

Install PHP 7.2

sudo dnf module reset php
sudo dnf module enable php:remi-7.2
sudo dnf install php

Install PHP Modules

You may also require additional PHP modules to run your PHP application.

sudo dnf install php-gd php-mysqlnd php-soap

Test PHP Version

After succesfull installation use the followign command to test the installed PHP version.

php -v

PHP 7.3.12 (cli) (built: Nov 19 2019 10:24:51) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.12, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.12, Copyright (c) 1999-2018, by Zend Technologies

Share it!
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
Rahul
Rahul
Connect on Facebook Connect on Twitter

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

Related Posts

  • How To Install LAMP (Apache, MySQL, PHP) on Debian 10

    November 24, 2019
  • How to Install Nginx with PHP-FPM on Ubuntu 18.04 LTS

    November 14, 2019
  • How to Install Apache with PHP-FPM on Ubuntu 18.04 LTS

    November 13, 2019
  • How to Install PostgreSQL on CentOS 8 & RHEL 8

    November 10, 2019
  • How to Install and Configure Apache on CentOS/RHEL 8

    November 8, 2019

Leave a Reply

Cancel reply

Popular Posts

  • How to Install Python 3.8 on Ubuntu, Debian and LinuxMint
  • How to Restart Network Service on CentOS 8 or RHEL 8
  • How to Check IP Address on CentOS 8
  • How to Install Java 11/8 on Amazon Linux
  • How to Configure Static IP on CentOS 8 (CLI)
Copyright © 2013-2019 TecAdmin.net. All Rights Reserved. This site uses cookies. By using this website you agree with our term and services
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkNo
Revoke cookies