Install php extension amqp

Mitch

Verified User
Joined
Apr 16, 2013
Messages
62
Hi,

I couldn't find much information about installing amqp, but I would like to install it on my server (for rabbitmq).
But how do I enable this extension?

I have custombuild2.

In the interface I went to Customize Compilation -> php71 and I added --with-amqp after that I rebuild php but still there is no extension when I check the commandline "php -m".

What do I do wrong?
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,854
Location
GMT +7.00
Hello,

Since it's a PECL extension you need to use either pecl to install it or phpize/make/make install

- https://pecl.php.net/package/amqp
- http://php.net/manual/fa/amqp.installation.php


Help links:

- Compiling shared PECL extensions with the pecl command
http://php.net/manual/fa/install.pecl.pear.php

- Compiling shared PECL extensions with phpize
http://php.net/manual/fa/install.pecl.phpize.php

- example on how to use phpize: Installing Alternative PHP Cache (APC)
https://help.directadmin.com/item.php?id=400

- Installing a Pecl-extension for PHP on Directadmin server
https://help.poralix.com/articles/installing-a-pecl-extension-for-php-on-directadmin-server
 

Mitch

Verified User
Joined
Apr 16, 2013
Messages
62
I did try that "/usr/local/php71/bin/pecl install amqp" but I get the next message:

Code:
/usr/local/php71/bin/pecl install amqp
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
downloading amqp-1.9.3.tgz ...
Starting to download amqp-1.9.3.tgz (101,342 bytes)
......................done: 101,342 bytes
28 source files, building
running: phpize71
Configuring for:
PHP Api Version:         20160303
Zend Module Api No:      20160303
Zend Extension Api No:   320160303
Set the path to librabbitmq install prefix [autodetect] :
building in /tmp/pear/temp/pear-build-adminskhtaO/amqp-1.9.3
running: /tmp/pear/temp/amqp/configure --with-php-config=/usr/local/php71/bin/php-config71 --with-librabbitmq-dir
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr/local/php71
checking for PHP includes... -I/usr/local/php71/include/php -I/usr/local/php71/include/php/main -I/usr/local/php71/include/php/TSRM -I/usr/local/php71/include/php/Zend -I/usr/local/php71/include/php/ext -I/usr/local/php71/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/php71/lib/php/extensions/no-debug-non-zts-20160303
checking for PHP installed headers prefix... /usr/local/php71/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking for amqp support... yes, shared
checking for amqp... yes, shared
yes
checking for pkg-config... /usr/bin/pkg-config
checking for amqp using pkg-config... configure: error: librabbitmq not found
ERROR: `/tmp/pear/temp/amqp/configure --with-php-config=/usr/local/php71/bin/php-config71 --with-librabbitmq-dir' failed
I have installed Installed librabbitmq:
Code:
# yum install librabbitmq
Loaded plugins: presto, security
Setting up Install Process
Package librabbitmq-0.5.2-1.el6.remi.x86_64 already installed and latest version
Nothing to do
I tried to google what to do but I find many old topics and compile it your self answers .
 

Mitch

Verified User
Joined
Apr 16, 2013
Messages
62
Ah nice, that workrs!

Since I already added the
Code:
--with-amqp
in the custombuild options I only have to rebuild PHP right?
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,854
Location
GMT +7.00
no, please read the links I've posted above on how to install/add PECL extensions.
 

Mitch

Verified User
Joined
Apr 16, 2013
Messages
62
Ah I see, adding the
Code:
extension=amqp.so
will do, thanks for the help!
 
Top