install swoole

## 下载
tioncico@tioncico-PC:/tmp$ wget https://github.com/swoole/swoole-src/archive/v4.4.23.tar.gz
# 如果使用 github 下载慢,请到 pecl 进行下载 
# tioncico@tioncico-PC:/tmp$ wget https://pecl.php.net/get/swoole-4.4.23.tgz 

## 解压到当前目录
tioncico@tioncico-PC:/tmp$ tar -zvxf v4.4.23.tar.gz

## cd 到解压之后的目录
tioncico@tioncico-PC:/tmp$ cd swoole-src-4.4.23/ 

## 使用 phpize 创建 php 编译检测脚本 ./configure
##【注意:需要选择 php 对应版本的 phpize,这里使用的是绝对路径,否则编译安装无法生效】
tioncico@tioncico-PC:/tmp/swoole-src-4.4.23$ /usr/local/php-7.2.2/bin/phpize

## 创建编译文件,第一个 --with,后面是 php-config 的所在路径(这个路径一般和 php 在同一个目录) /usr/local/php-7.2.2/bin/php-config,第二个 --enable,是开启 Swoole 的 ssl 功能,第三个 --enable(可选参数),是开启 Swoole 支持 http2 相关的功能
tioncico@tioncico-PC:/tmp/swoole-src-4.4.23$ ./configure --with-php-config=/usr/local/php-7.2.2/bin/php-config --enable-openssl --enable-http2

## 编译 Swoole 并把编译好的文件移动到 php 的扩展目录(前面的配置 php 版本的扩展目录) 需要root权限
tioncico@tioncico-PC:/tmp/swoole-src-4.4.23$ sudo make && make install 

## 编译成功会显示如下:
Build complete.
Don't forget to run 'make test'.

Installing shared extensions:     /usr/local/php-7.2.2/lib/php/extensions/no-debug-non-zts-20160303/
Installing header files:          /usr/local/php-7.2.2/include/php/

Are there any code examples left?
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source