共计 1683 个字符,预计需要花费 5 分钟才能阅读完成。
背景:
有个我的项目须要装置 laravel-queue-rabbitmq, 但在 composer install 时爆以下谬误:
No composer.lock file present. Updating dependencies to latest instead of installing from lock file. See https://getcomposer.org/install for more information.
Loading composer repositories with package information
Warning: Accessing nexus.officemate.cn over http which is an insecure protocol.
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- php-amqplib/php-amqplib[v2.11.0, ..., 2.x-dev] require ext-sockets * -> it is missing from your system. Install or enable PHP's sockets extension.
- vladimir-yuldashev/laravel-queue-rabbitmq v10.2.3 requires php-amqplib/php-amqplib ^2.11 -> satisfiable by php-amqplib/php-amqplib[v2.11.0, ..., 2.x-dev].
- Root composer.json requires vladimir-yuldashev/laravel-queue-rabbitmq 10.2.3 -> satisfiable by vladimir-yuldashev/laravel-queue-rabbitmq[v10.2.3].
To enable extensions, verify that they are enabled in your .ini files:
- D:\willen\phpStudy\PHPTutorial\php\php-7.2.1-nts\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-sockets` to temporarily ignore these required extensions.
报错截图:
查问材料后,发现起因是要应用 RabbitMQ
的话,要先在本地装置 php-amqplib 扩大,这个对应的是 amqp 扩大;
装置步骤:
1. 执行 php -v
查看本地环境;
2.ampq 扩大装置
http://pecl.php.net/package/amqp
windows 点击红色框框的内容,抉择和 php 版本匹配的文件下载,下载后 php_amqp.dll 放到 php 的 ext,我的本地是 phpstudy,在 D:\willen\phpStudy\PHPTutorial\php\php-7.2.1-nts\ext
rabbitmq.4.dll 放到 php 目录下,即和 php.exe 在一个目录,我的目录是 D:\willen\phpStudy\PHPTutorial\php\php-7.2.1-nts
3.php.ini 增加扩大
extension=php_amqp.dll
留神
rabbitmq.4.dll 放在 php 目录下,是因为如果不放在这里的话,当执行“php”命令的时候会报“无奈启动此程序,因为计算机中失落 rabbitmq.4.dll。尝试重新安装该程序以解决此问题”谬误,如图:
4. 重启 php 环境
能够看到 amqp 扩大
5. 再次 composer install
还是报这个错,
解决办法:须要开启 sockets
扩大,而后重启 php 就能够了
正文完