cloudpanel安装swoole扩展

apt update
apt install -y build-essential autoconf automake pkg-config libtool cmake clang -y
apt install -y php8.1-dev php8.4-cli php8.4-common -y
apt install -y libssl-dev libcurl4-openssl-dev libpq-dev libsqlite3-dev libzstd-dev libbrotli-dev liburing-dev libssl-dev -y

 git clone https://github.com/swoole/swoole-src.git &&    cd swoole-src
/usr/bin/phpize8.4
./configure \
   --with-php-config=/usr/bin/php-config8.4 \
  --enable-swoole \
  --enable-sockets \
  --enable-mysqlnd \
  --enable-swoole-curl \
  --enable-swoole-pgsql \
  --enable-swoole-sqlite \
  --enable-swoole-stdext \
  --enable-zstd \
  --enable-brotli \
  --enable-uring-socket 

make && make install

echo extension=swoole.so >/etc/php/8.4/cli/conf.d/20-swoole.ini

 

systemctl服务

[Unit]
Description=Swoole HTTP Server
After=network.target
StartLimitIntervalSec=0

[Service]
Type=simple

ExecStart=/usr/bin/php /opt/start.php start swoole
ExecReload=/bin/kill -USR1 $MAINPID

# 自动重启策略
Restart=always
RestartSec=3

# 防止僵尸进程
KillMode=process
KillSignal=SIGTERM
TimeoutStopSec=30

# 资源限制
LimitNOFILE=1048576
LimitNPROC=65535

# 日志
StandardOutput=journal
StandardError=journal

User=www-data
Group=www-data

[Install]
WantedBy=multi-user.target

添加新评论 »