Linux下給PHP安裝amqp擴充 linux 安裝php7 php安裝 centos php安

來源:互聯網
上載者:User
本文介紹了在Linux下給PHP安裝amqp擴充的過程,有需要的朋友可以關注一下。

安裝librabbitmq-c和rabbitmq-codegen

# 下載0-9-1版的rabbitmq-cgit clone git://github.com/alanxz/rabbitmq-c.gitcd rabbitmq-c# Enable and update the codegen git submodulegit submodule initgit submodule update# Configure, compile and installautoreconf -i && ./configure && make && sudo make install

安裝pecl擴充

#下載最新的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

記得在php.ini中加入amqp擴充:

extension=amqp.so

安裝過程中可能會遇到的問題

1、缺少libtool包

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 is undefinedMakefile.am:3:Makefile.am:3: The usual way to 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: installing ./depcompautoreconf: automake failed with exit status: 1

解決辦法,安裝libtool,ubuntu:

sudo apt-get install libtool

其他系統類別似

2、如果還有其他問題,歡迎給我留言,我補上

使用

 '127.0.0.1',    'port' => '5672',    'login' => 'guest',    'password' => 'guest',    'vhost'=>'/');//建立串連$conn = 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"),);//生產者,向RabbitMQ發送訊息$message = $exchange->publish(json_encode($data), 'key');if (!$message) {    echo 'Message not sent', PHP_EOL;} else {    echo 'Message sent!', PHP_EOL;}//消費者while ($envelope = $queue->get(AMQP_AUTOACK)) {    echo ($envelope->isRedelivery()) ? 'Redelivery' : 'New Message';    echo PHP_EOL;    echo $envelope->getBody(), PHP_EOL;}?>

以上就介紹了Linux下給PHP安裝amqp擴充,包括了Linux,php安裝方面的內容,希望對PHP教程有興趣的朋友有所協助。

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    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.