Linux Install the AMQP Extensions Linux installation php7 php install CentOS PHP

Source: Internet
Author: User
Tags rabbitmq
This article describes the process of installing the AMQP extension to PHP under Linux, and a friend who needs to pay attention to it.

Installing Librabbitmq-c and Rabbitmq-codegen

# download version 0-9-1 rabbitmq-cgit clone GIT://GITHUB.COM/ALANXZ/RABBITMQ-C.GITCD rabbitmq-c# Enable and update the CodeGen git sub Modulegit submodule initgit submodule update# Configure, compile and Installautoreconf-i &&./configure && ; Make && sudo make install

Installing the PECL Extension

#下载最新的amqp扩展wget Http://pecl.php.net/get/amqp-1.0.9.tgztar xvzf amqp-1.0.9.tgzcd amqp-1.0.9 && phpize./ Configure--WITH-AMQP && make && sudo make install

Remember to include the AMQP extension in php.ini:

Extension=amqp.so

Issues that you may encounter during the installation

1, Missing Libtool package

Configure.ac:installing./install-shconfigure.ac:installing./missingconfigure.ac:34:installing./ Config.guessconfigure.ac:34:installing./config.submakefile.am:3: Libtool library used but Libtool are Undefinedmakefile.am:3:makefile.am:3: The usual-define LIBTOOL is-to-add Ac_prog_libtoolmakefile.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.acMakefile.am:installing./compilemakefile.am:insta Lling./depcompautoreconf:automake failed with exit Status:1

Workaround, install Libtool,ubuntu:

sudo apt-get install Libtool

Similar to other systems

2, if there are other questions, welcome to leave me a message, I fill in

Use

  ' 127.0.0.1 ', ' port ' = ' 5672 ', ' login ' = ' guest ', ' Password ' + ' guest ', ' vhost ' = '/');//Create Connection $co nn = new amqpconnection ($conn _args), if (! $conn->connect ()) {die (' not connected '). PHP_EOL);} Open Channel$channel = new Amqpchannel ($conn);//Declare Exchange$exchange = new Amqpexchange ($channel); $exchange- >setname (' extest '); $exchange->settype (' fanout '); $exchange->declare ();//Create queue$queue = new Amqpqueue ($channel); $queue->setname (' qutest '); $queue->declare ();//Bind It on the exchange to routing.key$exchange-> Bind (' qutest ', ' Routing.key '); $data = Array (' Name ' = ' foobar ', ' Args ' = = Array ("0", "1", "2", "3"),);//producer, Send Message to RABBITMQ $message = $exchange->publish (Json_encode ($data), ' key '), if (! $message) {echo ' message not sent ', php_ EOL;} else {echo ' Message sent! ', Php_eol;} Consumer while ($envelope = $queue->get (amqp_autoack)) {echo ($envelope->isredelivery ())?    ' Redelivery ': ' New Message '; Echo PHP_eol; echo $envelope->getbody (), Php_eol;}? >

The above describes the Linux to install the AMQP extension to PHP, including the linux,php installation aspects, I hope that the PHP tutorial interested in a friend helpful.

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