日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Mac下安装event库

發布時間:2023/12/9 编程问答 18 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Mac下安装event库 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

因為使用的GatewayWorker框架使用了swoole,但swoole依賴于event,所以必須安裝下event擴展!

?

1. 最初使用brew install libevent安裝了下,運行gatewayworker發現錯誤依然存在!

2. 考慮到是php里使用event,所以改用pecl去安裝,先用pecl search event搜索了下,結果如下:

[zcm@7.2 47]$pecl search event Retrieving data...0% .Matched packages, channel pecl.php.net: ======================================= Package Stable/(Latest) Local event 2.4.1 (stable) Provides interface to libevent library libevent 0.1.0 (beta) Libevent - event notification

但是用pecl install libevent時,發現因為這個版本是beta版本,所以下載失敗。。。。

改用pecl install event,安裝過程中因為無法找到openssl的庫路徑而安裝失敗,因此改用先下載安裝包,再自行解壓安裝

3. pecl download event

tar -zxvf event-2.4.1.tgz

cd event event-2.4.1

phpize

./configure --with-php-config=/usr/local/opt/php/bin/php-config --enable-event-debug=yes --enable-event-sockets=yes --with-event-libevent-dir=/usr --with-event-pthreads --with-event-extra --with-event-openssl --with-event-ns --with-openssl-dir=/usr/local/Cellar/openssl/1.0.2o_1

make

make install

編譯并安裝完成!

4. 配置

mvim /usr/local/etc/php/7.2/php.ini

添加: extension="event.so"

保存并退出

5. 測試:

php -m | grep event

如果有event就說明對了

?

===========================================================

同樣, 安裝php的swoole擴展時如果啟用openssl, 可能也會遇到同樣的問題, 在一系列的折騰后, 在以下目錄發現有用的腳本文件:

[zcm@swoole-4.3.5 14]$pwd /Users/zcm/Downloads/swoole-4.3.5 [zcm@swoole-4.3.5 15]$cat make.sh phpize --clean phpize ./configure --enable-openssl --enable-sockets --enable-mysqlnd --enable-http2 make clean make -j make install

根據我自己電腦上openssl庫的路徑,在./configure命令中加入了以下參數"?--with-openssl-dir=/usr/local/Cellar/openssl/1.0.2s"

再執行sh make.sh, 最后安裝成功, 安裝成功后, 記得要在php.ini文件中啟用swoole擴展, 即添加: extension="swoole.so"

最后在命令行中執行: php -m | grep swoole 檢測是否有swoole了!

總結

以上是生活随笔為你收集整理的Mac下安装event库的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。