简体   繁体   English

在 Windows 10 和 PHP 7.3 中安装 AMQP

[英]Install AMQP in windows 10 & PHP 7.3

i want to install AMQP in windows 10 with PHP 7.3 for use in symfony 4. windows not use any apache/iis/nginx and run directly by symfony.我想在 Windows 10 中使用 PHP 7.3 安装 AMQP,以便在 symfony 4 中使用。Windows 不使用任何 apache/iis/nginx 并直接由 symfony 运行。

everything ok!一切还好! until, i decide to use rabbitmq in project and need amqp for it.直到,我决定在项目中使用rabbitmq,并且需要amqp。

So, 1. download AMQP 1.9.4 (php 7.3 compatible)所以,1.下载AMQP 1.9.4 (兼容php 7.3)
2. copy php_amqp.dll to c:\php 2.复制php_amqp.dll到c:\php
3. copy rabbitmq.4.dll (AMQP 1.9.4 compatible) to c:\windows\system32 3.将rabbitmq.4.dll(AMQP 1.9.4兼容)复制到c:\windows\system32
4. add extension=php_amqp.dll > php.ini 4. 添加扩展=php_amqp.dll > php.ini
5. php.ini extension_dir = "ext" 5. php.ini extension_dir = "ext"

but i get this error:但我收到此错误:

PHP Warning:
PHP Startup: Unable to load dynamic library 'php_amqp.dll'
(tried: ext\php_amqp.dll (The specified module could not be found.),
ext\php_php_amqp.dll.dll (The specified module could not be found.)) in Unknown on line 0

i try these instruction:我尝试这些指令:
1. change php.ini extension_dir to "C:\php\ext\" 1. 将 php.ini extension_dir 更改为 "C:\php\ext\"
2. install openssl 1.1 2.安装openssl 1.1
3. copy libeay32.dll,ssleay32.dll into "c:\windows\system32" 3.将libeay32.dll,ssleay32.dll复制到“c:\windows\system32”
4. restart, restart, restart, ... 4.重启,重启,重启,...

how can i solve this problem?我怎么解决这个问题?

Try:尝试:

  • copying php_amqp.dll and php_amqp.pdb into \php\ext\将 php_amqp.dll 和 php_amqp.pdb 复制到 \php\ext\
  • copying rabbitmq.4.dll and rabbitmq.4.pdb into \php\将 rabbitmq.4.dll 和 rabbitmq.4.pdb 复制到 \php\

It didn't work for me with PHP 7.2.13RC1, but it works with PHP 7.2.17它不适用于 PHP 7.2.13RC1,但它适用于 PHP 7.2.17

I'm using Windows 10, x64, PHP non thread safe我正在使用 Windows 10、x64、PHP 非线程安全

1) generate phpinfo file, check - Architecture ie: x86 - PHP Extension Build ie: API20170718,TS,VC15 - Thread Safety ie: enabled 1) 生成 phpinfo 文件,检查 - Architecture ie: x86 - PHP Extension Build ie: API20170718,TS,VC15 - Thread Safety ie: enabled

2) go to https://pecl.php.net/package/amqp find version of library acording to your PHP ver, and thread safe or not thread safe 2) 转到https://pecl.php.net/package/amqp根据您的 PHP 版本查找库版本,以及线程安全或非线程安全

like here: https://pecl.php.net/package/amqp/1.9.4/windows像这里: https ://pecl.php.net/package/amqp/1.9.4/windows

3) unzip/tar package copy php_amqp.dll into ext dir in php dir (ie: c:/xammp/php/ext) 3) unzip/tar 包将php_amqp.dll复制到php dir中的ext dir(即:c:/xammp/php/ext)

4) edit php.ini add "extension=php_amqp.dll" 4) 编辑 php.ini 添加“extension=php_amqp.dll”

copy rabbitmq.4.dll and rabbitmq.4.pdb into ie: c:/xammp/php将rabbitmq.4.dll和rabbitmq.4.pdb复制到ie:c:/xammp/php

5) install Win32OpenSSL (save dlls in windows/system dir) 5) 安装 Win32OpenSSL(将 dll 保存在 windows/系统目录中)

https://slproweb.com/products/Win32OpenSSL.html https://slproweb.com/products/Win32OpenSSL.html

  1. Be shure you download compatible version php and amqp libriary (thread-save or no9t-thread-safe, x86 or x64).请务必下载兼容版本的phpamqp库(thread-save 或 no9t-thread-safe、x86 或 x64)。

For example:例如:

links to all versions for windows: windows所有版本的链接:

AMQP https://pecl.php.net/package/amqp/1.9.4/windows AMQP https://pecl.php.net/package/amqp/1.9.4/windows

PHP https://windows.php.net/download/ PHP https://windows.php.net/download/

  1. You need to register dll regsvr32 c:\windows\system32\rabbitmq.4.dll (or copy rabbitmq.4.dll to c:\php\ dir)您需要注册 dll regsvr32 c:\windows\system32\rabbitmq.4.dll (或将 rabbitmq.4.dll 复制到c:\php\ dir)

and move php_amqp.dll to extension dir move c:\php\php_amqp.dll c:\php\ext\并将 php_amqp.dll 移动到扩展目录move c:\php\php_amqp.dll c:\php\ext\

I had same problem to install amqp with XAMPP(if that is a case) Make sure you downloaded Thread-safe version for amqp Rest of configuration is showed above我在使用 XAMPP 安装 amqp 时遇到了同样的问题(如果是这种情况)确保您下载了 amqp 的线程安全版本 其余配置如上所示

  1. Add php_amqp.dll in xampp/php/extxampp/php/ext中添加 php_amqp.dll
  2. Add rabbit.dll windows/system32添加rabbit.dll windows/system32
  3. in php.ini add extension=php_amqp.dll在 php.ini 添加 extension=php_amqp.dll

That's it.而已。

copy rabbitmq.4.dll to php/ directory.将 rabbitmq.4.dll 复制到 php/ 目录。 That saved my life with php 8.1.4.那用 php 8.1.4 救了我的命。 First moved it to php/ext and doesn't work首先将其移至 php/ext 并不起作用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM