10

I am having this error while installing pecl/amqp

when I type in the command line: pear install pecl/amqp

WARNING: php_bin C:\xampp\php.\php.exe appears to have a suffix .\php.exe,

but

config variable php_suffix does not match
ERROR: The DSP amqp.dsp does not exist.

I need to install this so that I can use amqp (RabbitMQ) on php.

Wilt
  • 41,477
  • 12
  • 152
  • 203
See Sharp Beta
  • 147
  • 1
  • 4
  • 12
  • possible duplicate of [Connect to RabbitMQ from PHP - Windows](http://stackoverflow.com/questions/13776164/connect-to-rabbitmq-from-php-windows) – Wilt Apr 15 '15 at 12:00

6 Answers6

18

@ AMQP installation php.net:

Note to Windows users: This extension does not currently support Windows since the librabbitmq library does not yet support Windows.

But here at RabbitMQ website is a windows installer...

Apparently the information on the php.net page is outdated


To install do like this:

  1. Download the correct package for your php from this official PECL amqp page
  2. unzip
  3. add php_amqp.dll to your php ext folder and enable the extension inside your php.ini file: extension=php_amqp.dll
  4. add rabbitmq.#.dll to your windows system 32 folder (where # corresponds with the version number).

All this according to the post on the blog I found here.


UPDATE

I updated some of the information above. The blog post is from 2013, and only mentioning older versions, but it is anyway a nice guide to the steps you need to take. Since then newer versions are available so be aware there are some slight differences in the process (mainly version numbers) if you want to install a newer version.

Wilt
  • 41,477
  • 12
  • 152
  • 203
12

This works for me in PHP 7.1, and amqp 1.9.4 for Windows.

  • Download the correct package in https://pecl.php.net/package/amqp based on your PHP version, architecture, thread safety, and compiler. You can check it in phpinfo
  • Copy php_amqp.dll to your php ext folder
  • Update your php.ini with: extension=php_amqp.dll
  • Copy rabbitmq.4.dll to your windows system 32 folder if 32bit system. add it to SysWOW64 if using 64bit system.
  • Restart apache.
Jim.B
  • 426
  • 6
  • 14
4

On Windows 10, build 19041 (2004 update), 64-bit.

Using Xampp with PHP 7.4.8.

  1. Go to here and download your relevant version: https://pecl.php.net/package/amqp (check which version you need in CLI using php -v)
  2. From the .zip, copy the rabbitmq.#.dll to C:/Windows/System32
  3. From the .zip, copy the php_amqp.dll to C:/xampp/php/ext (or simply your php/ext folder if using something else than Xampp)

If you've got PHP running as a service with Apache, restart Apache. If you're using it via CLI (e.g. via Bash and/or Symfony CLI server) then you're already good to go.


Other posts mention the 64-bit variant to have the rabbitmq.#.dll (where # is the version) to go in C:/Windows/SysWOW64. I tried that, didn't work for me, even though running 64-bit Windows and PHP.

$ php -v
PHP 7.4.8 (cli) (built: Jul  9 2020 11:30:39) ( ZTS Visual C++ 2017 x64 )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
rkeet
  • 3,406
  • 2
  • 23
  • 49
1

Although this will not answer how to install RabbitMQ with the pear install pecl/amqp, but have you ever tried to use rabbitmq with the pure php implementation php-amqplib?

  • Just a small note, the php-amqplib is slower then the pecl amqp library. One of the reasons, the amqp library is natively written in C. Unfortunately I don't have the benchmark results so show the difference :( but it's easy to benchmark – Ali Alwash May 08 '17 at 10:58
  • @AliAlwash true, but it all depends what you need to do. We use it to spawn background stuff which not called often, so performance is not a bottleneck here. But on another project we wrote a consumer in java as benchmarks were much better. Use the right tool for the right job :) – Toni Van de Voorde May 09 '17 at 06:51
  • I totally agree with you. It was more a side-node. – Ali Alwash May 09 '17 at 10:35
1

After many hours of search: To install amqp to php7.4 & Windows 10 (https://pecl.php.net/package/amqp),

  1. Choose the good file (x86,x64,ts,nts)
    php -i or phpinfo() (Architecture => x64)
    php -i|findstr "Thread" (ts or nts enable)

  2. Copy
    rabbitmq.4.dll and rabbitmq.4.pdb files to PHP root folder
    php_amqp.dll and php_amqp.pdb files to PHP\ext folder

  3. Add extension=amqp to the php.ini file

  4. check php -m if you show amqp (php -v to show errors)

Big thank's to Rezende (tutorial)

Adelraiser
  • 27
  • 5
0

If you are on Windows, on this Url you can download the installable rabbitmq and here is the direct download link for RabbitMQ 3.9.11.

You can also use choco to install it using:

choco install rabbitmq

And since, rabbitmq is implemented/written in erlang you also need erlang to be able to install rabbitmq and its services. Make sure you download erlang and install it.

Jamshaid K.
  • 3,555
  • 1
  • 27
  • 42