CentOSLinuxTutorials

How To Install PHP 7.3 on CentOS 8

Install PHP 7.3 On CentOS 8

In this tutorial, we will show you how to install PHP 7.3 on CentOS 8. For those of you who didn’t know, PHP (PHP: Hypertext Preprocessor) is a server-side scripting language designed for web development but also used as a general-purpose programming language. PHP code is interpreted by a web server with a PHP processor module, which generates the resulting web page: PHP commands can be embedded directly into an HTML source document rather than calling an external file to process data.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of PHP 7.3 on a CentOS 8.

Prerequisites

  • A server running one of the following operating systems: CentOS 8.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install PHP 7.3 On CentOS 8

Step 1. First, you need to enable Remi and EPEL yum repositories on your system.

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
yum install -y https://rpms.remirepo.net/enterprise/remi-release-8.rpm

Step 2. Installing PHP 7.3 in CentOS 8.

First, enable php:remi-7.3 the module to install PHP 7.3 using the following command:

yum module enable php:remi-7.3

Now we can install PHP 7.3 and some common extensions for it. We’re also installing these extensions because you’ll find that many software like CMS (WordPress, Joomla, etc) require these extensions from time to time, so it’s good to have them readily installed:

yum install php-dom php-simplexml php-ssh2 php-xml php-xmlreader php-curl php-date php-exif php-filter php-ftp php-gd php-hash php-iconv php-json php-libxml php-pecl-imagick php-mbstring php-mysqlnd php-openssl php-pcre php-posix php-sockets php-spl php-tokenizer php-zlib

Step 3. Verify the Install PHP version.

Once it is completed, you can ensure that the latest stable release of PHP 7.3 is installed on your system by using the command:

$ php -v
PHP 7.3.10 (cli) (built: Sep 24 2019 09:20:18) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.10, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.10, Copyright (c) 1999-2018, by Zend Technologies

To test PHP, create a test file named info.php with the content below. Save the file, then browse to it to see if PHP is working:

nano /var/www/html/info.php
<?php
phpinfo();
?>

Congratulations! You have successfully installed PHP 7. Thanks for using this tutorial for installing PHP 7.3 on your CentOS 8 system. For additional help or useful information, we recommend you check the official PHP website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button