# Điều kiện
* Bài hướng dẫn hướng đến hệ điều hành Centos 7. Nếu bạn dùng hệ điều hành khác, bạn vẫn có thể dùng tài liệu này làm điểm tham chiếu
* Mọi lệnh cấu hình và cài đặt được thực hiện dưới tài khoản root
# Chuẩn bị
## Disable selinux
vi /etc/selinux/config Đảm bảo dòng SELINUX=disable
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
## Update OS
yum -y update
## Update time
yum -y install ntp
systemctl start ntpd && systemctl enable ntpd
timedatectl set-timezone Asia/Ho_Chi_Minh
Kiểm tra
date -> so với giờ hiện tại
## Disable firewalld
systemctl disable firewalld && systemctl stop firewalld
## Reboot server
reboot
# Install PHP 7
## Install repo and utils
Install epel-repo
yum -y install epel-release
Install remi-repo
yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
Install yum-utils
yum -y install yum-utils
## Install php 7.x and modules
### Nếu bạn muốn dùng php 7.0
yum-config-manager --disable "remi-php*"
yum-config-manager --enable "remi-php70"
yum -y install php php-cli php-common php-devel php-fpm php-gd php-imap php-ldap php-mbstring php-opcache php-pdo php-pear php-pecl-apcu php-pecl-redis php-pecl-memcached php-pecl-igbinary php-xml php-xmlrpc php-mysqlnd zip unzip php-zip php-mcrypt php-snmp php-soap php-intl php-bcmath php-imap php-process
### Nếu bạn muốn dùng php 7.1
yum-config-manager --disable "remi-php*"
yum-config-manager --enable "remi-php71"
yum -y install php php-cli php-common php-devel php-fpm php-gd php-imap php-ldap php-mbstring php-opcache php-pdo php-pear php-pecl-apcu php-pecl-redis php-pecl-memcached php-pecl-igbinary php-xml php-xmlrpc php-mysqlnd zip unzip php-zip php-mcrypt php-snmp php-soap php-intl php-bcmath php-imap php-process
### Nếu bạn muốn dùng php 7.2
yum-config-manager --disable "remi-php*"
yum-config-manager --enable "remi-php72"
yum -y install php php-cli php-common php-devel php-fpm php-gd php-imap php-ldap php-mbstring php-opcache php-pdo php-pear php-pecl-apcu php-pecl-redis php-pecl-memcached php-pecl-igbinary php-xml php-xmlrpc php-mysqlnd zip unzip php-zip php-mcrypt php-snmp php-soap php-intl php-bcmath php-imap php-process
### Nếu bạn muốn dùng php 8.0
yum-config-manager --disable "remi-php*"
yum-config-manager --enable "remi-php80"
yum -y install php php-cli php-common php-devel php-fpm php-gd php-imap php-ldap php-mbstring php-opcache php-pdo php-pear php-pecl-apcu php-pecl-redis php-pecl-memcached php-pecl-igbinary php-xml php-xmlrpc php-mysqlnd zip unzip php-zip php-mcrypt php-snmp php-soap php-intl php-bcmath php-imap php-process
### Nếu bạn muốn dùng php 8.2
yum-config-manager --disable "remi-php*"
yum-config-manager --enable "remi-php82"
yum -y install php php-cli php-common php-devel php-fpm php-gd php-imap php-ldap php-mbstring php-opcache php-pdo php-pear php-pecl-apcu php-pecl-redis php-pecl-memcached php-pecl-igbinary php-xml php-xmlrpc php-mysqlnd zip unzip php-zip php-mcrypt php-snmp php-soap php-intl php-bcmath php-imap php-process
Check
php -v
Hướng dẫn cài PHP 7 trong Centos 8: https://www.tecmint.com/install-php-on-centos-8/
Cảm ơn bạn đã trả lời.