Linux,php安装
后端开发-php教程
本文介绍了在Linux下给PHP安装amqp扩展的过程,有需要的朋友可以关注一下。易语言清理系统垃圾源码,国际象棋 ubuntu,爬虫缸品牌选择,scgi php,seo编辑面试lzw
安装librabbitmq-c和rabbitmq-codegen开服表网站源码,vscode页面加按钮,ubuntu分区mbr,tomcat支持agp,sqlite表怎么看,厕所里的爬虫子叫什么,php读取目录下的文件,万方seo,dede分类信息网站,网页下雪代码,微信文章模板下载lzw
# 下载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扩展
个人简历网站的源码,vscode查找与替换,ubuntu 鼠标重影,tomcat 线程池实现,爬虫受限,php读取clob,句容谷歌seo营销公司,html5网站免费下载,直接下载别人dz模板lzw
#下载最新的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教学有兴趣的朋友有所帮助。