swoole安装(phpize)

之前听说swoole改了PHP的世界,于是就一直想尝试,然而以战败结束。
总结了自己失败原因
- 对添加PHP扩展流程不熟悉。
- 对扩展安装的每一步没有清晰认识。
例如:phpize命令,只知道安装扩展需要它但并不知道需要它的原因。

安装swoole扩展
PHPize 很多安装了PHP并没有安装phpize(包括我)由于我们下载下来得是C需要自己编译,因此编译C需要头文件,然而在php*-dev 中有需要编译的头,因此在安装时如果安装了php7.1-dev ,那么久可以直接使用phpize,如果没有直接安装phpize模块。

安装phpize ( 安装PHP7教程)

#搜索PHP7的模块
vagrant@learning:~$ sudo apt-cache search php7-* | grep dev
php7.0-dev - Files for PHP7.0 module development
php-all-dev - package depending on all supported PHP development packages
php7.1-dev - Files for PHP7.1 module development
php7.2-dev - Files for PHP7.2 module development
vagrant@learning:~$ sudo apt-get install php7.1-dev #安装模块
在安装的时候错了小错误,于是更新源
vagrant@learning:~$  apt-get update
vagrant@learning:~$ phpize
Cannot find config.m4.
Make sure that you run '/usr/bin/phpize' in the top level source directory of the module #安装成功
下面安装swoole
vagrant@learning:~$ wget  https://github.com/swoole/swoole-src/archive/v2.0.10-stable.tar.gz
vagrant@learning:~$ tar  zxvf v2.0.10-stable.tar.gz
vagrant@learning:~$ cd  swoole-src-2.0.10-stable/
vagrant@learning:~/swoole-src-2.0.10-stable$ phpize
Configuring for:
PHP Api Version:         20160303
Zend Module Api No:      20160303
Zend Extension Api No:   320160303
vagrant@learning:~/swoole-src-2.0.10-stable$ ./configure
#出现一下结果表示成功
....
----------------------------------------------------------------------
Libraries have been installed in:
   /home/vagrant/swoole-src-2.0.10-stable/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

vagrant@learning:~/swoole-src-2.0.10-stable$ sudo make install
#最后一步
#编译安装成功后,修改php.ini加入
extension=swoole.so

最后确认是否安装成功
vagrant@learning:/etc/php/7.1/cli$ php -m | grep swoole
swoole #OK

你可能感兴趣的:(PHP,三维otsu图像分割)