当前位置:  开发笔记 > 编程语言 > 正文

安装swoole后,运行php无解析,无法运行

如图所示{代码}phpinfo()swoolesupportenabledVersion1.7.19Authortianfeng.han[email:mikan.tenny@gmail.com]epollenabledeventfdenabledtimerfdenabledsignalfdenabledcpuaffinityenabledspin
如图所示

vagrant@vagrant-ubuntu-trusty-64:~$ php server.php 
$http = new swoole_http_server("0.0.0.0", 9501);

$http->on('request', function ($request, $response) {
    var_dump($request->get, $request->post);
    $response->header("Content-Type", "text/html; charset=utf-8");
    $response->end("

Hello Swoole. #".rand(1000, 9999)."

"); }); $http->start(); vagrant@vagrant-ubuntu-trusty-64:~$

phpinfo()

swoole support enabled
Version 1.7.19
Author tianfeng.han[email: mikan.tenny@gmail.com]
epoll enabled
eventfd enabled
timerfd enabled
signalfd enabled
cpu affinity enabled
spinlock enabled
rwlock enabled
Linux Native AIO enabled
Gcc AIO enabled
pcre enabled
zlib enabled
mutex_timedlock enabled
pthread_barrier enabled


php -i

vagrant@vagrant-ubuntu-trusty-64:~$ php -i |grep swoole
vagrant@vagrant-ubuntu-trusty-64:~$

回复内容:

如图所示

vagrant@vagrant-ubuntu-trusty-64:~$ php server.php 
$http = new swoole_http_server("0.0.0.0", 9501);

$http->on('request', function ($request, $response) {
    var_dump($request->get, $request->post);
    $response->header("Content-Type", "text/html; charset=utf-8");
    $response->end("

Hello Swoole. #".rand(1000, 9999)."

"); }); $http->start(); vagrant@vagrant-ubuntu-trusty-64:~$

phpinfo()

swoole support enabled
Version 1.7.19
Author tianfeng.han[email: mikan.tenny@gmail.com]
epoll enabled
eventfd enabled
timerfd enabled
signalfd enabled
cpu affinity enabled
spinlock enabled
rwlock enabled
Linux Native AIO enabled
Gcc AIO enabled
pcre enabled
zlib enabled
mutex_timedlock enabled
pthread_barrier enabled


php -i

vagrant@vagrant-ubuntu-trusty-64:~$ php -i |grep swoole
vagrant@vagrant-ubuntu-trusty-64:~$

1,php -i | grep ini ,找到配置文件,
2,查看ini配置文件地址
3,检查 extension=swoole.so 是否配置
4,php -m | grep swoole

推荐阅读
mylvfamily
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有