php源码安装swoole及基本使用

1.源码编译安装php7

2.下载最新版本的swoole(www.swoole.cm)

git  https://gitee.com/swoole/swoole.git

因为swoole文件夹中没有configure文件,所以要先生成configure

3.在swoole文件夹运行

cd swoole   

/usr/local/php/bin/phpize(php安装的路径) 生成configure 文件

./configure --help查看参数

./configure --with-php-config=/usr/local/php/bin/php-config  命令执行完之后

 

安装中间可能出现的问题:

     (1). configure: error: in `/home/swoole': configure: error: C++ preprocessor "/lib/cpp" fails sanity check

       解决:    yum install gcc-c++

     (2).cannot find autoconf. Please check your autoconf installation 

       解决:    yum install autoconf

 

4.make && make install

会返回extension文件夹,swoole.so文件就在该文件夹中

php源码安装swoole及基本使用

这就是swoole结合php7源码编译安装swoole

5.在php.ini中添加extension=swoole

php -m查看所有拓展文件,如果有的话就说明swoole执行成功

php源码安装swoole及基本使用

然后就可以开心的使用swoole啦!!!

查看swoole版本   php -r 'echo SWOOLE_VERSION;'

 

tcp

    php tcp.php   重新开一个终端使用       telnet 127.0.0.1 9501

http

    php http_server.php  重新开一个终端使用    curl  http://127.0.0.1:8899

查看正在使用的进程

    netstat  -anp|grep 9501

    kill -s 9  12109(要杀死的进程号)

telnet的安装

  查看yum源当中的版本   

   yum list|grep telnet

 yum 安装telnet
   yum install telnet-server.x86_64 -y