In this article, we will have explained the necessary steps to install and configure PHP 7.3 on CentOS 7. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.
PHP: Hypertext Preprocessor (or simply PHP) is a server-side scripting language designed for Web development, but also used as a general-purpose programming language. The standard PHP interpreter, powered by the Zend Engine, is free software released under the PHP License. PHP has been widely ported and can be deployed on most web servers on almost every operating system and platform, free of charge. PHP 7.3 is the latest stable version of PHP.
Install PHP 7.3 on CentOS
Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.
sudo yum install epel-release sudo yum update
Step 2. Install PHP.
First, Add PHP 7.3 Remi repository:
sudo yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm sudo yum -y install epel-release yum-utils
By default, the enabled repository is for PHP 5.4. Disable this repo and enable on for PHP 7.3:
sudo yum-config-manager --disable remi-php54 sudo yum-config-manager --enable remi-php73
Install PHP 7.3 and some of the most common PHP modules:
sudo yum install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysqlnd
Verify the PHP installation, by typing the following command which will print the PHP version:
# php -v PHP 7.3.1 (cli) (built: May 16 2019 13:55:46) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.1, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.3.1, Copyright (c) 1999-2018, by Zend Technologies
If you are using Apache as your web server then just restart the Apache service using the following command and you are good to go:
sudo systemctl restart httpd
Congratulation, you have learned how to install and configure PHP on CentOS 7. If you have any question, please leave a comment below.