首頁  >  文章  >  後端開發  >  安装swoole后,运行php无解析,无法运行

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

WBOY
WBOY原創
2016-06-06 20:25:521949瀏覽

如图所示

<code class="shell">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("<h1>Hello Swoole. #".rand(1000, 9999)."</h1>");
});

$http->start();
vagrant@vagrant-ubuntu-trusty-64:~$ </code>

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:~$

回复内容:

如图所示

<code class="shell">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("<h1>Hello Swoole. #".rand(1000, 9999)."</h1>");
});

$http->start();
vagrant@vagrant-ubuntu-trusty-64:~$ </code>

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

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn