how to install php amqp in ubuntu
Asked Answered
B

4

16

I am try to install amqp for php (Integrating PHP with RabbitMQ) using this http://code.google.com/p/php-amqp/.

after run phpize && ./configure --with-amqp && make && sudo make install

it give error like this

Cannot find config.m4. Make sure that you run '/usr/bin/phpize' in the top level source directory of the module

Please help me, my environment is ubuntu

Bestir answered 20/10, 2011 at 5:8 Comment(0)
J
21

You need to download the code for the PHP library from here: http://code.google.com/p/php-amqp/downloads/list

Then cd into that folder and run the command they tell you to run.

UPDATE: That page is actually an old page, they haven't updated it in a long time. You can grab the latest amqp from http://pecl.php.net/get/amqp:

wget http://pecl.php.net/get/amqp -O amqp.tar.gz
tar -zxvf amqp.tar.gz
cd amqp-1.0.7    # replace this with the current version
phpize
./configure --with-amqp
make
sudo make install

Then you'll need to add the following line to your php.ini file:

extension=amqp.so
Java answered 3/4, 2012 at 16:11 Comment(1)
Could you @Java Werlich please accept my answer if you think it solved your problem or was the most helpful in finding your solution. Thank you. Cheers!Spates
S
17

Let's make life easier, we have tow options:

  1. If you're using Debian, you can easily install the AMQP extension for PHP with the following command (adjust the PHP version to match your setup):
    sudo apt install php7.4-amqp
This command not only installs the extension but also takes care of enabling it in your php.ini configuration file.
  1. Another option is to install the extension via PECL using this command:
    pecl install amqp

After a successful installation, make sure to add the following line to your php.ini configuration file (be sure to provide the full path to the extension): extension = amqp.so

This allows PHP to recognize and load the AMQP extension.

Spates answered 29/9, 2018 at 22:0 Comment(1)
php7.4-amqp for relevant versions etcJonas
D
4

You cannot use the "Symfony\Component\Messenger\Bridge\Amqp\Transport\Connection" as the "amqp" extension is not installed.

 sudo apt install php-amqp -y
Drava answered 20/10, 2020 at 15:28 Comment(0)
P
3

You are missing the required libraries and tools to compile a PHP extension.

On Debian/Ubuntu you can get them with:

sudo apt-get install php5-dev
Proulx answered 13/1, 2012 at 13:53 Comment(2)
Actually I've spent a whole day trying to install the extension in my production machine and I still didn't manage to install it. Why aren't there precompiled downloads of the extension for the most popular distros? It's absurd that I have to install a bunch of development tools in the production server just to be able to install one library. Now I'm stuck.Sandry
php5-dev would install other things which you do not want to have on a production machine.Lorinalorinda

© 2022 - 2024 — McMap. All rights reserved.