Install amqp extension for PHP

Source: Internet
Author: User
Tags version control system rabbitmq automake

One of the greatest extensions ever used, I wonder if you have tried it ............ Various Errors! Have wood ?! ¥ # @ % &*......

For a long time, I only compiled an extension version of 0.1.x. I looked at it and wiped it. The function was poor---|

No, continue ~

After a day of hard work, we finally got an eye open. Please summarize it ~

----------------------------------------------- I am a split line ---------------------------------------------------

Amqp-Advanced Message Queue Protocol. The famous implementation is probably the famous rabbitmq.

(For children's shoes I don't know, let's take a look at this article and repost it: [rabbitmq + Python getting started classic] Rabbit and rabbit nest)

PHP extensions are officially recommended. OK, it's the http://php.net/manual/en/book.amqp.php.

To install the amqp PHP extension, you must first install the» librabbitmq library. you will need the 0-9-1 version of The rabbitmq-C client library, linked to the rabbitmq-codegen version that corresponds to the version of
Broker you are using. Use the following steps to download and install the Library:


# Download the rabbitmq-C library @ version 0-9-1

Hg clone http://hg.rabbitmq.com/rabbitmq-c/rev/b01825ecc112 (rabbitmq-C)

CD rabbitmq-C

# Add the codegen requirement. To find the full list, go here: http://hg.rabbitmq.com/rabbitmq-codegen/tags

# And copy the URL for the appropriate broker version.

Hg clone http://hg.rabbitmq.com/rabbitmq-codegen/rev/16bbcb711380 codegen

# Configure, compile and install

Autoreconf-I &./configure & make & sudo make install

Extensions are written in C. Because communication between C and rabbitmq generally depends on the rabbitmq-C library (that is, librabbitmq), you must first install the dependent library before compiling the extension. Okay, install it as required ~

The original article uses the Hg tool and requires mercurial (a lightweight version control system). We will not introduce it here. We still use the traditional method.

First, download the rabbitmq-C v0.2: https://github.com/alanxz/rabbitmq-c/tags or direct shell:

Wget https://github.com/alanxz/rabbitmq-c/tarball/0.2

Tar zxvf 0.2

CD alanxz-rabbitmq *

(Why is version 0.2? Well, I don't know. In short, the compatibility of all its versions is very poor ...... It was found that version 0.2 was still smooth --)

Next, download the latest version of codegen accessories: https://github.com/rabbitmq/rabbitmq-codegen/downloads, or direct shell:

Wget https://github.com/rabbitmq/rabbitmq-codegen/tarball/master

Tar zxvf master

MV rabbitmq-* codegen

(The above step must be decompressed and put into the codegen directory in the rabbitmq-C directory, that is, the last step above .)

According to the manual introduction, first:

Autoreconf-I

If everything goes well and no error is reported, congratulations! The following are general operations:

./Configure & make install

If no error is reported, wow, I can only say you Nb! You can directly perform extended compilation.

However, in most cases, you may encounter various error messages like me, so let's talk about the compilation extension here.

Directly back to the official download (I downloaded version 1.0.0, new version I have nothing to try, it should be OK) http://pecl.php.net/package/amqp, and compiled into the so file or shell:

Wget http://pecl.php.net/get/amqp-1.0.0.tgz

Tar zxvf amqp-1.0.0.tgz

CD amqp-1.0.0

/Usr/local/PHP/bin/phpize

./Configure -- With-PHP-Config =/usr/local/PHP/bin/PHP-config -- With-amqp

Make & make install

(/Usr/local/PHP/bin/phpize and/usr/local/PHP/bin/PHP-config are the directories where the actual PHP is located. If you are not clear about them, view them in whereis PHP .)

If the previous steps are successful, there should be no problem in this step. Simply add the generated amqp. So in PHP. ini and restart httpd or PHP-CGI.

--------------------------------------------------- I am a split line ----------------------------------------------------

Well, if you are as sad as you are, and report an error from autoreconf-I, I will provide some useful solutions.

Autoreconf may encounter the following error:

Onfigure. AC: 60: Error: Possibly undefined macro: as_case
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
Configure. AC: 69: Error: Possibly undefined macro: as_if
Configure. AC: 92: Error: Possibly undefined macro: ac_path_progs_feature_check
Configure. AC: 97: Error: Possibly undefined macro: ac_msg_result
Configure: 2907: Error: Possibly undefined macro: m4_foreach_w
Autoreconf:/usr/bin/Autoconf failed with exit status: 1

The strange thing is that when I execute again, different errors are reported...

Configure. AC: Installing './install-Sh'

Configure. AC: Installing './missing'

Configure. AC: 34: Installing './config. Guess'

Configure. AC: 34: Installing './config. sub'

Makefile. AM: 3: libtool library used but 'libtool' is undefined

Makefile. AM: 3:

Makefile. AM: 3: The usual way to define 'libtool' is to add 'ac _ prog_libtool'

Makefile. AM: 3: to 'configure. AC' and run 'aclocal' and 'autoconf' again.

Makefile. AM: C objects in subdir but 'am _ prog_cc_c_o 'not in 'configure. AC'

Makefile. AM: Installing './compile'

Makefile. AM: Installing './depcomp'

Autoreconf: automake failed with exit status: 1

First, make sure that some necessary dependent libraries are installed, such as libtool, Autoconf, and automake.

You can download, compile, and install the SDK on your own, and perform routine operations. Here I am directly using Yum:

Yum install libtool Autoconf automake

Let's see where libtoolize is:

Whereis libtoolize

For example, libtoolize:/usr/bin/libtoolize.

/Usr/bin/libtoolize

This error may also occur:

/Usr/share/aclocal/libmcrypt. M4: 17: Warning: underquoted definition of am_path_libmcrypt

/Usr/share/aclocal/libmcrypt. M4: 17: Run info' (automake) extending aclocal'

/Usr/share/aclocal/libmcrypt. M4: 17: Or see http://sources.redhat.com/automake/automake.html#Extending-aclocal

The solution is as follows:

Edit:/usr/share/aclocal/libmcrypt. M4

Modify 17 rows:Ac_defun (am_path_libmcrypt,
IsAc_defun ([am_path_libmcrypt],

--------------------------------------------------- I am a split line ----------------------------------------------------

/Usr/bin/libtoolize may report the following error:

Libtoolize: Putting auxiliary files in '.'.

Libtoolize: Linking File './ltmain. Sh'

Libtoolize: consider adding 'ac _ config_macro_dir ([M4]) 'to configure. AC and

Libtoolize: rerunning libtoolize, to keep the correct libtool Macros in-tree.

Libtoolize: consider adding '-I M4' to aclocal_amflags in makefile. am.

The error is clear. Follow the prompts to perform the following operations:

Edit:Configure. AC

Add a row:Ac_config_macro_dir ([M4])

Re-Execute:/Usr/bin/libtoolize

Edit:Makefile. AM

Add a row:Aclocal_amflags =-I M4

--------------------------------------------------- I am a split line ----------------------------------------------------

./Configure may report the following error:

Checking location of amqp codegen directory... configure: Error: cocould not find amqp spec file at "'/codegen/amqp-0.9.1.json '"

The directory in the configure file does not match the actual situation. Although it can be manually modified, it is not recommended that the version be changed because the version of rabbitmq-C does not match the codegen version.

Checking finding a Python with simplejson installed... configure: Error: cocould not find a python that can 'import simplejson'

Obviously, this error is caused by the lack of simplejson package in Python. you can install it in easy_install mode.

--------------------------------------------------- I am a split line ----------------------------------------------------

There are more error reports, but they are not recorded one by one. The solution is as follows:"Error message" + "google "!

BTW: I believe that you will be able to feel the following:F * ck the GFW !!!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.