To assemble an amqp extension for PHP

Source: Internet
Author: User
Tags version control system rabbitmq automake
Installing AMQP Extensions for PHP

One of the most pit daddy's ever-expanding installation, I don't know if you've ever tried ... Various errors Ah! Is there any wood?! ¥#@%%&* ...

Tinkering with the half-day, only compiled a 0.1.x version of the extension, look at, wipe, the poor function of less ah--| | |

No, go on.

After a day of efforts, God finally eyes, hurriedly summed up the next ~

-----------------------------------------------I'm a split line---------------------------------------------------

amqp--Advanced Message Queuing protocol, the current more famous implementation is probably the famous rabbitmq.

(Do not know the children's shoes first look at my this reprint: "[Rabbitmq+python] rabbit and Rabbit Nest")

The PHP extension is, of course, officially recommended as well. OK, that's it. http://php.net/manual/en/book.amqp.php

To install the AMQP PHP extension, must first install the? LIBRABBITMQ Library. You'll need the 0-9-1 version of the RABBITMQ-C client library, linked to the Rabbitmq-codegen version that corresponds The to the version of the broker is 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

The extension is written in C, because C communicates with RABBITMQ generally relies on the RABBITMQ-C library (that is, LIBRABBITMQ), so it is necessary to install the dependent library before compiling the extension. All right, then, just pack it on demand.

The original is the HG tool, need to install mercurial (a lightweight version control system), here is not introduced, we still use the traditional method.

First, download the v0.2 version of Rabbitmq-c here: 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 version 0.2?) Well, I do not know, in short, its version of the compatibility is very bad, after I repeatedly failed to try to fail repeatedly ... Found the 0.2 version is smooth--)

Next, download the latest version of the CodeGen accessory: 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

(This step must be unpacked and placed in the CodeGen directory of the Rabbitmq-c directory, which is the last step above.) )

As described in the manual, first:

Autoreconf-i

If you are all right, no error, then congratulations! The following is a general operation:

./configure && make && make install

If you still don't get an error, wow, I can only say you nb! It is possible to extend the compilation directly.

However, most of the time you may be the same as I encountered a variety of error messages, then we say later, here is the extension of the compilation by the end.

Directly back to the official download (i downloaded the 1.0.0 version, the new version I have nothing to try, should also be possible) HTTP://PECL.PHP.NET/PACKAGE/AMQP, and compiled into 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 for the actual PHP directory, if not clear, you can whereis PHP view.) )

If the previous steps are smooth, this step should be no problem, directly in the php.ini add the generated amqp.so, restart httpd or php-cgi can, no longer repeat.


---------------------------------------------------I'm a split line----------------------------------------------------

Well, if you're as sad as I am, I'm going to give you an error from Autoreconf-i, so here are some things that might be useful.

Autoreconf may encounter the following error:

onfigure.ac:60:error:possibly undefined macro:as_case
If this token and others is 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

Strangely enough, when I do it again, I make a different mistake ...

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 to define ' LIBTOOL ' are 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 ' isn't in ' configure.ac '

Makefile.am:installing './compile '

Makefile.am:installing './depcomp '

Autoreconf:automake failed with exit Status:1

First, ensure that some of the necessary dependencies are installed, such as: Libtool, autoconf, Automake, etc.

This everyone Google download and compile the installation, general operation, nothing to say, here I direct yum:

Yum Install Libtool autoconf automake

See where the libtoolize is:

Whereis libtoolize

Display Example: libtoolize:/usr/bin/libtoolize, you can perform a

/usr/bin/libtoolize

---------------------------------------------------I'm a split line----------------------------------------------------

Errors that may be reported when/usr/bin/libtoolize:

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 instructions:

Editor:Configure.ac

Add one line:Ac_config_macro_dir ([M4])

Re-execution:/usr/bin/libtoolize

Editor:makefile.am

Add a line:aclocal_amflags=-i M4

---------------------------------------------------I'm a split line----------------------------------------------------

./configure may be reported error:

Checking location of amqp CodeGen directory ... configure:error:could not find AMQP spec file at "'/codegen/amqp-0.9.1.js On ' "

The directory in the Configure file does not match the actual situation, although it can be resolved by manual modification, but it is not recommended, in fact, should be rabbitmq-c and CodeGen version mismatch caused by the replacement version.


Checking finding a python with Simplejson installed ... configure:error:could not find a python that can ' import Simplejs On

Obviously, this error is due to Python's lack of a Simplejson package, which can be installed by Easy_install mode.

---------------------------------------------------I'm a split line----------------------------------------------------

There are more error cases, there is no record, in short, the solution is:"error message" + "Google"!

BTW: Believe in searching for a while you will be heartily realize:F*ck the gfw!!!





  • Related Article

    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.