报错信息:
composer install
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Your lock file does not contain a compatible set of packages. Please run composer update.
Problem 1
- open-smf/connection-pool is locked to version v1.0.16 and an update of this package was not requested.
- open-smf/connection-pool v1.0.16 requires ext-swoole >=4.2.9 -> it is missing from your system. Install or enable PHP's swoole extension.
Problem 2
- topthink/think-swoole is locked to version v3.1.4 and an update of this package was not requested.
- topthink/think-swoole v3.1.4 requires ext-swoole >=4.4.8 -> it is missing from your system. Install or enable PHP's swoole extension.
To enable extensions, verify that they are enabled in your .ini files:
- /Applications/MAMP/bin/php/php7.4.21/conf/php.ini
You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with --ignore-platform-req=ext-swoole
to temporarily ignore these required extensions.
运行环境:PHP7.4.21、mamp、macbook pro
从mamp中的打开配置文件入口打开的php.ini文件中(末尾)已经添加了extension=swoole.so,但是运行composer install时还是会出现未添加swoole扩展的错误;
如果要忽略这个错误进行安装,可以在composer install后添加选项--ignore-platform-req=ext-swoole
,但是当依赖数量较多时操作起来还是非常不方便。
解决办法:
运行命令:php -i | grep php.ini找到php.ini的路径,在这个文件中添加extension=swoole.so即可。