登录注册

18250178511

Swoole入门指南:PHP7安装Swoole详细教程(一)

作者:admin      时间:2018-03-20 09:19:03

环境

这里不在使用apache做为web server。该用nginx + php-fpm,性能更强大,配置更方便。并且为了跟上php的步伐,也使用了比较新的php版本

  • [x] centos7
  • [x] php7.0.12
  • [x] nginx/1.10.2
  • [x] php-fpm

下载 swoole

首先下载swoole的源码包,这个操作很简单,没有太多说的。

wget -c https://github.com/swoole/swoole-src/archive/v2.1.1.tar.gz 
解压: tar -zxvf v2.1.1.tar.gz cd swoole-src-2.1.1/

./configure 来做编译配置检测

make进行编译,make install进行安装

命令执行:

[root@php7 swoole-src-2.0.6]# phpize 
[root@php7 swoole-src-2.0.6]# ./configure 
[root@php7 swoole-src-2.0.6]# make && make install 



make install后,如果正确,会出现以下内容

[root@php7 swoole-src-2.0.6]# make install
Installing shared extensions:     /usr/lib64/php/modules/

					
					
					
					
					


这表示,在 /usr/lib64/php/modules/ 目录中,成功生成了 swoole.so 文件

修改配置文件

要能够使用该模块,还需要在 php.ini 文件中添加该模块。

这里需要注意,php7的模块配置文件均单独分开了。
在 php.ini 中可找到如下内容

;;;;
; Note: packaged extension modules are now loaded via the .ini files
; found in the directory /etc/php.d; these are loaded by default.
;;;;

因此,如果你的php安装时,如果未特殊设置,可以在/etc/php.d 目录中,找到添加模块的配置文件。

进入到 cd /etc/php.d 目录,完成相关的配置

[root@php7 swoole-src-2.0.6]# vim swoole.ini ; Enable swoole extension module extension=swoole.so

上一篇:php

下一篇:php获取当前毫秒时间戳


发表评论

评论列表

匿名

cost lanoxin 250 mg <a href="https://dilano.pro/">buy digoxin 250 mg without prescription</a> order molnunat 200mg generic

2023-06-02 14:47:10

匿名

cost diamox 250mg <a href="https://isosdur.life/">purchase imdur</a> brand imuran 50mg

2023-06-01 05:26:21

匿名

order coreg 6.25mg pills <a href="https://cenfored.com/">buy cenforce 50mg generic</a> order aralen 250mg without prescription

2023-06-01 03:34:47

匿名

buy temovate <a href="https://amiodar.beauty/">cordarone 200mg drug</a> brand cordarone 100mg

2023-05-30 09:21:56

匿名

buy cheap generic benicar <a href="https://buyxdival.shop/">order generic divalproex</a> brand divalproex 500mg

2023-05-29 19:20:26