How to install beta php8.0 on CentOS8

1 minute read

Background

It seems that php8.0 will be released on November 26, 2020.
A beta version is also available in the repository of remi, so install it and check the operation.

Installation method

Copy and paste to create PHP8 environment with CentOS8, about 100th decoction
How to install Centos8 php8.0
php80-php-8.0.0~beta4-32.el8.remi.x86_64.rpm

Put the body of php.

dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
dnf install yum-utils
dnf --enablerepo=remi install php80-php

I want to try connecting to the database, so I put mariadb

dnf install mariadb-server
systemctl start mariadb.service
mysql_secure_installation

Insert the php module.

dnf install --enablerepo=remi php80-php-mysqlnd php80-php-mysqli php80-php-gd php80-php-cli php80-php-opcache
dnf install --enablerepo=remi php80-php-pecl-zip php80-php-devel php80-php-pear

Commands such as php, pear, and pecl do not pass the path just by installing them, so find them with find and call them with the full path.

find / -name pear
find / -name pecl
/opt/remi/php80/root/usr/bin/pecl install APCu
/opt/remi/php80/root/usr/bin/pear install Mail_MimeDecode
/opt/remi/php80/root/usr/bin/pear install HTTP_Client
/opt/remi/php80/root/usr/bin/pear install Net_IPv6

Switching versions using alternatives is fine, but this time it’s not a test.
Switch between multiple versions of PHP

Start httpd and php. It seems that php-fpm is usually included these days.

systemctl start httpd.service
systemctl start php80-php-fpm.service

Execute phpinfo (); and check “Loaded Configuration File” to check the path of php.ini.
php_ini.png
Added to php.ini.

php.ini


extension=apcu.so

Restart php.

systemctl restart php80-php-fpm.service

result

There is no problem with gd and mysqli.
Both OPcache and apcu are working normally.
Fixed Net_IPv6 throwing Fatal error.

/opt/remi/php80/root/usr/share/pear/Net/IPv6.php


#Near line 806
#            $ip{$pos} = '_'; #Before correction
            $ip[$pos] = '_'; #Revised