MAMP Pro 安装Swoole日志

文章目录

  • 通过pecl 安装
  • 问题: ` fatal error: ‘openssl/ssl.h‘ file not found`
  • 问题:`#error "Enable openssl support, require openssl library"`
  • 成功信息
  • 安装成功后依赖提示缺少`swoole`库

通过pecl 安装

参考官方文档

pecl install swoole

问题: fatal error: ‘openssl/ssl.h‘ file not found

如果没安装openssl的话, 先安装openssl

`brew install openssl`

如果已安装 , 则做一个链接

ln -s /usr/local/opt/openssl/include/openssl /usr/local/include/openssl

问题:#error "Enable openssl support, require openssl library"

安装提示 enable openssl support?[no] 时 , 直接使用brew安装的openssl目录即可 , 输入

yes --with-openssl-dir=/usr/local/Cellar/openssl/1.0.2q/

参考链接: https://www.cnblogs.com/xiaobaiskill/p/11062024.html

成功信息

Build process completed successfully
Installing '/Applications/MAMP/bin/php/php7.3.8/include/php/ext/swoole/config.h'
Installing '/Applications/MAMP/bin/php/php7.3.8/lib/php/extensions/no-debug-non-zts-20180731/swoole.so'
install ok: channel://pecl.php.net/swoole-4.4.5
configuration option "php_ini" is not set to php.ini location
You should add "extension=swoole.so" to php.ini

按照提示将extension=swoole.so 添加进php.ini中即可

安装成功后依赖提示缺少swoole

网上的坑友一般遇到的问题有

  1. phpinfo() 没有swoole
  2. php -m 没有swoole

而我遇到的情况是, 这两者都有, 但是通过composer install swoole项目时, 依然提示缺少swoole库

php --ri swool 也找不到

$ php --ri swool
Extension 'swool' not present.

不过最终还是按照官方文档 解决的

通过

php -i|grep php.ini
或者
php --ini

发现,虽然MAMP pro 中配置了extension=swoole.so , 但是配置的是/Library/Application Support/appsolute/MAMP PRO/conf/php7.3.8.ini 文件

Configuration File (php.ini) Path: 指向的是/Applications/MAMP/bin/php/php7.3.8/conf/php.ini 配置文件,在此文件中添加extension=swoole.so后,

久违的一幕终于出现了

CrocutaxdeMacBook-Pro:011_demo crocutax$ composer require easyswoole/easyswoole=3.x
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 17 installs, 0 updates, 0 removals
  - Installing easyswoole/spl (1.2.4): Downloading (100%)
  - Installing symfony/polyfill-util (v1.12.0): Downloading (100%)
  - Installing symfony/polyfill-php56 (v1.12.0): Downloading (100%)
  - Installing nikic/php-parser (v4.2.4): Downloading (100%)
  - Installing jeremeamia/superclosure (2.4.0): Downloading (100%)
  - Installing easyswoole/utility (1.1.1): Downloading (100%)
  - Installing easyswoole/component (1.9.2): Downloading (100%)
  - Installing easyswoole/task (1.0.4): Downloading (100%)
  - Installing easyswoole/config (1.0.3): Downloading (100%)
  - Installing dragonmantank/cron-expression (v2.3.0): Downloading (100%)         - Installing easyswoole/log (1.0.3): Downloading (100%)
  - Installing easyswoole/trigger (1.0.0): Downloading (100%)
  - Installing psr/http-message (1.0.1): Loading from cache
  - Installing nikic/fast-route (v1.3.0): Downloading (100%)
  - Installing easyswoole/validate (1.2.0): Downloading (100%)
  - Installing easyswoole/http (1.3.3): Downloading (100%)
  - Installing easyswoole/easyswoole (3.3.0): Downloading (100%)
Writing lock file
Generating autoload files

虽然此时php --ri swool 依然找不到swoole, 但是先不管了. 后期再说吧.

你可能感兴趣的:(PHP,工作日志)