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

Mister PKI

SSL Certificates * SSL Tools * Certificate Decoder

  • Buy SSL Certificates
  • Blog
  • OpenSSL
  • Keytool
  • SSL Tools
  • Donate

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

Training Courses

Top online courses in IT & Software

Cyber Security Training

Udemy - The Complete Internet Security Privacy Course icon

Buy SSL Certificates

The SSL Store

Comodo Store

Sectigo Store

RapidSSL

Recent Posts

  • Install PHP for Linux
  • Apereo CAS SLO
  • Azure AD Connect Synchronization
  • Redhat Disable IPv6
  • Linux ls human readable file size

Footer

  • Twitter
  • YouTube

Pages

  • About Mister PKI
  • Blog
  • Compare and Buy Affordable PKI Certificates
  • Contact Us
  • Full Disclosure
  • Privacy Policy
  • SSL Tools – Certificate Decoder and Certificate Checker

Copyright © 2023