• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Mister PKI

SSL Certificates * SSL Tools * Certificate Decoder

  • PKI Training
  • OpenSSL
  • Keytool
  • PKI Tools
    • Apereo CAS
    • SAML
    • OpenID Connect
  • Get expert help

Install PHP for Linux

February 14, 2023 by Mister PKI Leave a Comment

This article will demonstrate how to install php for Linux operating systems. Specifically, these instructions will cover how to install php on Redhat 8.

Install PHP on Redhat 8

The EPEL repository contains extra packages for linux that are not available by default on RHEL and CentOS. EPEL is short for Extra Packages for Enterprise Linux.

Follow these steps to successfully install PHP on Redhat 8. Root privileges are assumed.

  1. Install and enabled the EPEL repository. Note that the EPEL repository is a fedora project.
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
  1. Install the remi repository made available by the EPEL repository.
dnf install -y https://rpms.remirepo.net/enterprise/remi-release-8.rpm
  1. List the available php modules before choosing the version you wish to install.
dnf module list php
  1. Enable the latest PHP 8 module before installing PHP.
dnf module enable php:remi-8.2 -y
  1. Install PHP for Apache on Redhat. We have a separate article for installing Apache on Redhat.
dnf install php php-cli php-common
  1. Verify the installation was successful and the expected version is displayed.
php -v

Finally, create a test file named index.php and place it in your /var/www/html folder.

<?php
phpinfo();
?>

Restart your apache server (or nginx, although that was not covered in this article).

systemctl restart httpd

Your index.php will display your php installation information at http://localhost.

If you have difficulty accessing your site, ensure that the local firewall is not blocking you. We have a separate article on Redhat firewall management here.

Install PHP Extensions on Redhat Linux

To install additional php libraries and extensions that may not be provided with the vanilla php install, run the following command.

dnf install php-{extension-name}

Then, running php -m will show the installed extensions.

Conclusion

This article has demonstrated how to install PHP for Linux, specifically for Redhat 8. Let us know in the comments if you have any questions or would like to see more examples of installing PHO on other flavors of Linux.

We hope you have found this document helpful and hope that more of our linux articles can be of use to you.

linux,  redhat

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Popular Posts

PKCS12

openssl s_client

Keytool

Keytool list

ECDSA vs RSA

OpenSSL

PKCS7

Certificate Decoder

PKI for DevOps Engineers – Free Training Series

PKI for DevOps Training Hub

Lesson 1 – How TLS and PKI Work

Lesson 2 – Understanding X.509 Certificates

Lesson 3 – Certificate Chains Explained

Lesson 4 – Debug TLS with OpenSSL

Lesson 5 – Verify Certificate Chains

Lesson 6 – Creating CSRs with OpenSSL

Lesson 7 – Working with PKCS12 Certificates

Lesson 8 – Java Keystores and keytool

Lesson 9 – Certificate Expiration Monitoring

Lesson 10 – Automating Certificate Renewal

Lesson 11 – Common TLS Errors

Lesson 12 – PKI Architecture for DevOps

Recent Posts

  • Apache mod_auth_cas: Protect Web Applications with Apereo CAS and Docker
  • Apache mod_auth_mellon: Configure SAML SSO & Docker
  • Configure OpenID Connect (OIDC) in Apereo CAS 7.3 and 8
  • Certificate Ownership Is an Operating Model Problem, Not a Tooling Problem
  • OpenSSL dgst: Create Checksums and Verify Digital Signatures

Footer

  • Twitter
  • YouTube
Mister PKI

Practical security engineering for the systems that establish trust.

Learn OpenSSL Keytool Free training
Work together PKI consulting CAS consulting Sponsored contributions
Site About Support Mister PKI Cookie policy Search
© 2026 Mister PKI Secure systems. Clear guidance.