1: build redis模块redis.so:
//For Debian-based Linux distros you need a php-dev and pkg-php-tools packages
//to build native PHP extension from phpredis source code sudo apt update sudo apt install php-dev pkg-php-tools --yes sudo pecl channel-update pecl.php.net sudo pecl install redis
如果遇到第三步pecl有warning
Warning: foreach() argument must be of type array|object, null given in Command.php on line 249 PHP Warning: foreach() argument must be of type array|object, null given in /usr/share/php/PEAR/Command.php on line 249 Warning: Undefined array key "phpfile" in Role.php on line 204 PHP Warning: Undefined array key "phpfile" in /usr/share/php/PEAR/Installer/Role.php on line 204 Warning: Undefined array key "config_vars" in Role.php on line 46 PHP Warning: Undefined array key "config_vars" in /usr/share/php/PEAR/Installer/Role.php on line 46 Warning: Undefined array key "config_vars" in Role.php on line 46 PHP Warning: Undefined array key "config_vars" in /usr/share/php/PEAR/Installer/Role.php on line 46
执行这行,更新php到最新版8.0.3
sudo apt-get install php-xml php7.0-xml
2: 配置启动redis.so extension
//Build process completed successfully //Installing '/usr/lib/php/20200930/redis.so' //install ok: channel://pecl.php.net/redis-5.3.3 //configuration option "php_ini" is not set to php.ini location //You should add "extension=redis.so" to php.ini sudo vim /etc/php/8.0/cli/php.ini
//add one line of extension
extension=redis.so