1.开启wsl
2.apt换源
sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak && sudo vim /etc/apt/sources.list
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
apt update && apt upgrade
- 安装php
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list
wget -qO - https://packages.sury.org/php/apt.gpg | sudo apt-key add -
sudo apt update
sudo apt install php8.1 -y
-
安装php扩展
sudo apt install php8.1-{mysql,cli,common,imap,ldap,xml,fpm,curl,mbstring,zip}
-
安装swoole
sudo apt install php-dev
sudo apt install libmcrypt-dev
sudo apt install php-pear
sudo pecl install mcrypt-1.0.1
sudo pecl channel-update pecl.php.net
sudo pecl install mcrypt
sudo apt install libhiredis-dev
sudo apt install sed
sudo cp /bin/sed /usr/bin/sed
sudo apt install libpq-dev
sudo apt install php-igbinary
sudo apt install php-msgpack
sudo pecl install swoole
php -i | grep .ini
修改extension_dir目录地址为扩展目录路径,最后添加extension=swoole.so
- 安装redis
sudo pecl install igbinary
sudo pecl install msgpack
sudo apt install -y liblz4-dev
sudo apt install -y libzstd-dev
sudo pecl install redis
最后添加extension=redis.so
参考:https://www.cnblogs.com/luckcs/articles/11583691.html
标签:https,swoole,sudo,redis,wsl,apt,install,php,pecl From: https://www.cnblogs.com/winstonsias/p/17750964.html