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.
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.
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 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:
<?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.