Cara Installasi PHP 7 di Centos 7


Installation Steps of PHP 7.2 on CentOS 7 Server

1) Install yum-utils and enable EPEL repository

Login to your server and use the below yum command to install yum-utils & enable epel repository

yum install epel-release yum-utils -y

2) Download and Install remirepo using yum command

yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

3) Base on your requirement, configure the PHP 7.x repository

To configure PHP 7.2 repository, use below command,

yum-config-manager --enable remi-php72

4) Install PHP 7.2 along with dependencies.

yum install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysql php-pgsql -y

5) Verify the PHP version

Once all the PHP 7.2 and its dependencies are installed in step4), use below command to verify the installed PHP version,

php -v

PHP 7.2.7 (cli) (built: Jun 20 2018 08:21:26) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.7, Copyright (c) 1999-2018, by Zend Technologies

PHP 7 Test Page Verification

I am assuming Apache web Server is installed on your system, start its service using below systemctl command

systemctl start httpd

Now create a info.php file under /var/www/html with following contents,

cd /var/www/html/
nano info.php

<?php
phpinfo();
?>

Open the web browser and type the ip of your server followed by info.php,

http://Server-IP-Address/info.php

Referensi : https://www.linuxtechi.com/install-php-7-centos-7-rhel-7-server/

Leave a Reply

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