Installing amqp extensions for PHP

Source: Internet
Author: User
Tags automake
Installing amqp extensions for PHP is one of the most boring extensions in history. I wonder if you have tried it ............ Various errors! Have wood ?! ¥ # @ % & Amp ;*...... 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. -- | & nbsp; no, continue ~ Install amqp extension for PHP

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? 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 the 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

--------------------------------------------------- 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.