Nâng cấp PHP
Gỡ cài đặt PHP hiện tại
yum -y remove php*
Cài đặt PHP 8
Ở đây mình chọn phiên bản 8.1.
yum --enablerepo=remi,remi-php81 install -y php-fpm php-common
Cài đặt thêm PHP module (bắt buộc).
yum --enablerepo=remi,remi-php81 install -y php-opcache php-pecl-apcu php-cli php-pear php-pdo php-mysqlnd php-mysql php-pgsql php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml php-bcmath php-intl php-zip php-imagick
Khởi động PHP.
systemctl start php-fpm.service systemctl enable php-fpm.service
Cấu hình lại PHP-FPM
Sửa tập tin /etc/php-fpm.d/www.conf
, Thay user = apache
và group = apache
sang nginx
.
[...] ; Unix user/group of processes ; Note: The user is mandatory. If the group is not set, the default user's group ; will be used. ; RPM: apache Choosed to be able to access some dir as httpd user = nginx ; RPM: Keep a group allowed to write in log dir. group = nginx [...]
Khởi động lại PHP-FPM.
systemctl restart php-fpm.service
Đến đây, các bạn cần lặp lại cái bước tối ưu PHP-FPM và tùy chỉnh php.ini
theo nhu cầu.
Bật cập nhật cho PHP 8.1
yum install yum-utils rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm yum-config-manager --enable remi-php81
Sau đó về sau khi dùng lệnh yum -y update
thì PHP 8.1 sẽ được cập nhật.