Dalam artikel ini, kami akan membahas langkah-langkah terperinci untuk menginstal PHP 5.6 pada sistem operasi CentOS 7. Mulai dari menambahkan repositori yang diperlukan, mengaktifkan repositori Remi, hingga memasang PHP 5.6 dan modul terkait untuk Apache. Tutorial ini dirancang untuk membantu Anda meningkatkan versi PHP pada server CentOS 7 Anda, memastikan kinerja dan keamanan yang optimal untuk aplikasi web Anda. Ikuti panduan ini untuk setup PHP 5.6 yang lancar dan efektif.

sudo yum -y install epel-release
sudo yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm

Menginstall epel-release

[root@mysrv ~]# yum install epel-release
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-11 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================================================
 Package                                            Arch                                         Version                                    Repository                                    Size
===============================================================================================================================================================================================
Installing:
 epel-release                                       noarch                                       7-11                                       extras                                        15 k

Transaction Summary
===============================================================================================================================================================================================
Install  1 Package

Total download size: 15 k
Installed size: 24 k
Is this ok [y/d/N]: y
Downloading packages:
epel-release-7-11.noarch.rpm                                                                                                                                            |  15 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : epel-release-7-11.noarch                                                                                                                                                    1/1
  Verifying  : epel-release-7-11.noarch                                                                                                                                                    1/1

Installed:
  epel-release.noarch 0:7-11

Complete!
[root@mysrv ~]#

Install repository Remi

[root@mysrv ~]# yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
Loaded plugins: fastestmirror
remi-release-7.rpm                                                                                                                                                      |  28 kB  00:00:00
Examining /var/tmp/yum-root-1z99ih/remi-release-7.rpm: remi-release-7.9-6.el7.remi.noarch
Marking /var/tmp/yum-root-1z99ih/remi-release-7.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package remi-release.noarch 0:7.9-6.el7.remi will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================================================
 Package                                       Arch                                    Version                                          Repository                                        Size
===============================================================================================================================================================================================
Installing:
 remi-release                                  noarch                                  7.9-6.el7.remi                                   /remi-release-7                                   39 k

Transaction Summary
===============================================================================================================================================================================================
Install  1 Package

Total size: 39 k
Installed size: 39 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : remi-release-7.9-6.el7.remi.noarch                                                                                                                                          1/1
  Verifying  : remi-release-7.9-6.el7.remi.noarch                                                                                                                                          1/1

Installed:
  remi-release.noarch 0:7.9-6.el7.remi

Complete!
[root@mysrv ~]#

Menginstall yum utils

sudo yum -y install yum-utils
[root@mysrv ~]# yum -y install yum-utils
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink                                                                                                                                                    | 5.1 kB  00:00:00
 * epel: d2lzkl7pfhq30w.cloudfront.net
 * remi-safe: cdn.centos.no
epel                                                                                                                                                                    | 4.3 kB  00:00:00
remi-safe                                                                                                                                                               | 3.0 kB  00:00:00
(1/4): remi-safe/primary_db                                                                                                                                             | 2.6 MB  00:00:00
(2/4): epel/x86_64/group                                                                                                                                                | 399 kB  00:00:00
(3/4): epel/x86_64/updateinfo                                                                                                                                           | 1.0 MB  00:00:02
(4/4): epel/x86_64/primary_db                                                                                                                                           | 8.7 MB  00:00:09
Resolving Dependencies
--> Running transaction check
---> Package yum-utils.noarch 0:1.1.31-54.el7_8 will be installed
--> Processing Dependency: python-kitchen for package: yum-utils-1.1.31-54.el7_8.noarch
--> Processing Dependency: libxml2-python for package: yum-utils-1.1.31-54.el7_8.noarch
--> Running transaction check
---> Package libxml2-python.x86_64 0:2.9.1-6.el7_9.6 will be installed
--> Processing Dependency: libxml2 = 2.9.1-6.el7_9.6 for package: libxml2-python-2.9.1-6.el7_9.6.x86_64
---> Package python-kitchen.noarch 0:1.1.1-5.el7 will be installed
--> Processing Dependency: python-chardet for package: python-kitchen-1.1.1-5.el7.noarch
--> Running transaction check
---> Package libxml2.x86_64 0:2.9.1-6.el7.5 will be updated
---> Package libxml2.x86_64 0:2.9.1-6.el7_9.6 will be an update
---> Package python-chardet.noarch 0:2.2.1-3.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================================================
 Package                                          Arch                                     Version                                             Repository                                 Size
===============================================================================================================================================================================================
Installing:
 yum-utils                                        noarch                                   1.1.31-54.el7_8                                     base                                      122 k
Installing for dependencies:
 libxml2-python                                   x86_64                                   2.9.1-6.el7_9.6                                     updates                                   247 k
 python-chardet                                   noarch                                   2.2.1-3.el7                                         base                                      227 k
 python-kitchen                                   noarch                                   1.1.1-5.el7                                         base                                      267 k
Updating for dependencies:
 libxml2                                          x86_64                                   2.9.1-6.el7_9.6                                     updates                                   668 k

Transaction Summary
===============================================================================================================================================================================================
Install  1 Package  (+3 Dependent packages)
Upgrade             ( 1 Dependent package)

Total download size: 1.5 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/5): libxml2-python-2.9.1-6.el7_9.6.x86_64.rpm                                                                                                                        | 247 kB  00:00:00
(2/5): python-chardet-2.2.1-3.el7.noarch.rpm                                                                                                                            | 227 kB  00:00:00
(3/5): python-kitchen-1.1.1-5.el7.noarch.rpm                                                                                                                            | 267 kB  00:00:00
(4/5): yum-utils-1.1.31-54.el7_8.noarch.rpm                                                                                                                             | 122 kB  00:00:00
(5/5): libxml2-2.9.1-6.el7_9.6.x86_64.rpm                                                                                                                               | 668 kB  00:00:00
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                          2.6 MB/s | 1.5 MB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : libxml2-2.9.1-6.el7_9.6.x86_64                                                                                                                                              1/6
  Installing : libxml2-python-2.9.1-6.el7_9.6.x86_64                                                                                                                                       2/6
  Installing : python-chardet-2.2.1-3.el7.noarch                                                                                                                                           3/6
  Installing : python-kitchen-1.1.1-5.el7.noarch                                                                                                                                           4/6
  Installing : yum-utils-1.1.31-54.el7_8.noarch                                                                                                                                            5/6
  Cleanup    : libxml2-2.9.1-6.el7.5.x86_64                                                                                                                                                6/6
  Verifying  : python-chardet-2.2.1-3.el7.noarch                                                                                                                                           1/6
  Verifying  : libxml2-2.9.1-6.el7_9.6.x86_64                                                                                                                                              2/6
  Verifying  : libxml2-python-2.9.1-6.el7_9.6.x86_64                                                                                                                                       3/6
  Verifying  : python-kitchen-1.1.1-5.el7.noarch                                                                                                                                           4/6
  Verifying  : yum-utils-1.1.31-54.el7_8.noarch                                                                                                                                            5/6
  Verifying  : libxml2-2.9.1-6.el7.5.x86_64                                                                                                                                                6/6

Installed:
  yum-utils.noarch 0:1.1.31-54.el7_8

Dependency Installed:
  libxml2-python.x86_64 0:2.9.1-6.el7_9.6                           python-chardet.noarch 0:2.2.1-3.el7                           python-kitchen.noarch 0:1.1.1-5.el7

Dependency Updated:
  libxml2.x86_64 0:2.9.1-6.el7_9.6

Complete!
[root@mysrv ~]#

Disable repository remi php

[root@mysrv ~]# yum-config-manager --disable 'remi-php*'
[root@mysrv ~]# yum-config-manager --disable 'remi-php*'
Loaded plugins: fastestmirror
====================================================================================== repo: remi-php54 =======================================================================================
[remi-php54]
async = True
bandwidth = 0
base_persistdir = /var/lib/yum/repos/x86_64/7
baseurl =
cache = 0
cachedir = /var/cache/yum/x86_64/7/remi-php54
check_config_file_age = True
compare_providers_priority = 80
cost = 1000
deltarpm_metadata_percentage = 100
deltarpm_percentage =
enabled = False
enablegroups = True
exclude =
failovermethod = priority
ftp_disable_epsv = False
gpgcadir = /var/lib/yum/repos/x86_64/7/remi-php54/gpgcadir
gpgcakey =
gpgcheck = True
gpgdir = /var/lib/yum/repos/x86_64/7/remi-php54/gpgdir
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
hdrdir = /var/cache/yum/x86_64/7/remi-php54/headers
http_caching = all
includepkgs =
ip_resolve =
keepalive = True
keepcache = False
mddownloadpolicy = sqlite
mdpolicy = group:small
mediaid =
metadata_expire = 21600
metadata_expire_filter = read-only:present
metalink =
minrate = 0
mirrorlist = http://cdn.remirepo.net/enterprise/7/php54/mirror
mirrorlist_expire = 86400
name = Remi's PHP 5.4 RPM repository for Enterprise Linux 7 - x86_64
old_base_cache_dir =
password =
persistdir = /var/lib/yum/repos/x86_64/7/remi-php54
pkgdir = /var/cache/yum/x86_64/7/remi-php54/packages
proxy = False
proxy_dict =
proxy_password =
proxy_username =
repo_gpgcheck = False
retries = 10
skip_if_unavailable = False
ssl_check_cert_permissions = True
sslcacert =
sslclientcert =
sslclientkey =
sslverify = True
throttle = 0
timeout = 30.0
ui_id = remi-php54
ui_repoid_vars = releasever,
   basearch
username =
....
....
=============================================================================== repo: remi-php83-test-debuginfo ===============================================================================
[remi-php83-test-debuginfo]
async = True
bandwidth = 0
base_persistdir = /var/lib/yum/repos/x86_64/7
baseurl = http://rpms.remirepo.net/enterprise/7/debug-test83/x86_64/
cache = 0
cachedir = /var/cache/yum/x86_64/7/remi-php83-test-debuginfo
check_config_file_age = True
compare_providers_priority = 80
cost = 1000
deltarpm_metadata_percentage = 100
deltarpm_percentage =
enabled = False
enablegroups = True
exclude =
failovermethod = priority
ftp_disable_epsv = False
gpgcadir = /var/lib/yum/repos/x86_64/7/remi-php83-test-debuginfo/gpgcadir
gpgcakey =
gpgcheck = True
gpgdir = /var/lib/yum/repos/x86_64/7/remi-php83-test-debuginfo/gpgdir
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
hdrdir = /var/cache/yum/x86_64/7/remi-php83-test-debuginfo/headers
http_caching = all
includepkgs =
ip_resolve =
keepalive = True
keepcache = False
mddownloadpolicy = sqlite
mdpolicy = group:small
mediaid =
metadata_expire = 21600
metadata_expire_filter = read-only:present
metalink =
minrate = 0
mirrorlist =
mirrorlist_expire = 86400
name = Remi's PHP 8.3 test RPM repository for Enterprise Linux 7 - x86_64 - debuginfo
old_base_cache_dir =
password =
persistdir = /var/lib/yum/repos/x86_64/7/remi-php83-test-debuginfo
pkgdir = /var/cache/yum/x86_64/7/remi-php83-test-debuginfo/packages
proxy = False
proxy_dict =
proxy_password =
proxy_username =
repo_gpgcheck = False
retries = 10
skip_if_unavailable = False
ssl_check_cert_permissions = True
sslcacert =
sslclientcert =
sslclientkey =
sslverify = True
throttle = 0
timeout = 30.0
ui_id = remi-php83-test-debuginfo/x86_64
ui_repoid_vars = releasever,
   basearch
username =

[root@mysrv ~]#

Enable php 7.3 pada repository remi

sudo yum-config-manager --enable remi-php56
[root@mysrv ~]# yum-config-manager --enable remi-php56
Loaded plugins: fastestmirror
=================================================== repo: remi-php56 ===================================================
[remi-php56]
async = True
bandwidth = 0
base_persistdir = /var/lib/yum/repos/x86_64/7
baseurl =
cache = 0
cachedir = /var/cache/yum/x86_64/7/remi-php56
check_config_file_age = True
compare_providers_priority = 80
cost = 1000
deltarpm_metadata_percentage = 100
deltarpm_percentage =
enabled = 1
enablegroups = True
exclude =
failovermethod = priority
ftp_disable_epsv = False
gpgcadir = /var/lib/yum/repos/x86_64/7/remi-php56/gpgcadir
gpgcakey =
gpgcheck = True
gpgdir = /var/lib/yum/repos/x86_64/7/remi-php56/gpgdir
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
hdrdir = /var/cache/yum/x86_64/7/remi-php56/headers
http_caching = all
includepkgs =
ip_resolve =
keepalive = True
keepcache = False
mddownloadpolicy = sqlite
mdpolicy = group:small
mediaid =
metadata_expire = 21600
metadata_expire_filter = read-only:present
metalink =
minrate = 0
mirrorlist = http://cdn.remirepo.net/enterprise/7/php56/mirror
mirrorlist_expire = 86400
name = Remi's PHP 5.6 RPM repository for Enterprise Linux 7 - x86_64
old_base_cache_dir =
password =
persistdir = /var/lib/yum/repos/x86_64/7/remi-php56
pkgdir = /var/cache/yum/x86_64/7/remi-php56/packages
proxy = False
proxy_dict =
proxy_password =
proxy_username =
repo_gpgcheck = False
retries = 10
skip_if_unavailable = False
ssl_check_cert_permissions = True
sslcacert =
sslclientcert =
sslclientkey =
sslverify = True
throttle = 0
timeout = 30.0
ui_id = remi-php56
ui_repoid_vars = releasever,
   basearch
username =

[root@mysrv ~]#
sudo yum install php php-cli php-fpm php-gd php-mysqlnd php-pdo php-xml php-mbstring php-intl php-json php-zip php-pecl-apcu -y

Install mod php

sudo yum install mod_php

Check Versi PHP

[root@mysrv ~]# php -v
PHP 5.6.40 (cli) (built: Jun  5 2024 10:48:13)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
[root@mysrv ~]#
[root@mysrv ~]#

Restart Web Server

[root@mysrv ~]# systemctl restart httpd
[root@mysrv ~]#

Menambahkan file php info pada directory webserver

echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/php-test-info.php
[root@mysrv ~]# echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/php-test-info.php
<?php phpinfo(); ?>
[root@mysrv ~]#

Membuka firewall os untuk service webserver

[root@mysrv ~]# firewall-cmd --add-service=http --permanent
success
[root@mysrv ~]# firewall-cmd --reload
success
[root@mysrv ~]#

Leave a Reply

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