ubuntu下手动安装php-amqp模块教程
用于ubuntu的默认源里面没有php5-amqp这个包,所以要用上amqp得考手动编译。
参考手册 http://php.net/manual/pl/book.amqp.php
首先安装必须的php编译工具
- sudo apt-get install php5-dev
安装rabbitmq的库
- sudo apt-get install librabbitmq-dev
如果你的Linux发行版没有现成的librabbitmq-dev包,那么可以通过下载源码编译安装
然后如果你没有安装git话请安装一下git,因为我们要从官方的版本库中获取源代码
# 克隆源码并编译
- git clone git://github.com/alanxz/rabbitmq-c.git
- cd rabbitmq-c
- git submodule init
- git submodule update
# 编译库
- autoreconf -i && ./configure && make && sudo make install
然后我们需要去下载php扩展的源代码,地址在此:http://pecl.php.net/package/amqp
当前最新版本为1.0.10
- wget http://pecl.php.net/get/amqp-1.0.10.tgz
- tar zxf amqp-1.0.10.tgz
- cd amqp-1.0.10/
- phpize && ./configure --with-amqp && make && sudo make install
如果报错
- /root/amqp-1.0.9/amqp_queue.c: In function ‘read_message_from_channel’:
- /root/amqp-1.0.9/amqp_queue.c:341:11: error: ‘AMQP_FIELD_KIND_U64’ undeclared (first use in this function)
- /root/amqp-1.0.9/amqp_queue.c:341:11: note: each undeclared identifier is reported only once for each function it appears in
- /root/amqp-1.0.9/amqp_queue.c: In function ‘zim_amqp_queue_class_nack’:
- /root/amqp-1.0.9/amqp_queue.c:1093:2: error: unknown type name ‘amqp_basic_nack_t’
- /root/amqp-1.0.9/amqp_queue.c:1113:3: error: request for member ‘delivery_tag’ in something not a structure or union
- /root/amqp-1.0.9/amqp_queue.c:1114:3: error: request for member ‘multiple’ in something not a structure or union
- /root/amqp-1.0.9/amqp_queue.c:1115:3: error: request for member ‘requeue’ in something not a structure or union
- /root/amqp-1.0.9/amqp_queue.c:1120:3: error: ‘AMQP_BASIC_NACK_METHOD’ undeclared (first use in this function)
- make: *** [amqp_queue.lo] Error 1
是因为默认的librabbitmq-dev发行版的包比较旧,用上面git方式编译安装最新即可。
去下载最新的php扩展的源代码,地址在此:http://pecl.php.net/package/amqp
- wget http://pecl.php.net/get/amqp-x.x.x.tgz
- tar zxf amqp-x.x.x.tgz
- cd amqp-x.x.x/
- 继续执行
- phpize && ./configure --with-amqp && make && sudo make install
最后一步创建配置文件
- sudo echo "extension = amqp.so" > /etc/php5/conf.d/amqp.ini
重启web服务器在phpinfo页面中看到以下内容说明安装好了
sudo /etc/init.d/apache2 restart
http://localhost/phpinfo.php
启用rabbitamqp的图形界面
1.在安装amqp的时候会自动安装rabbitmq-plugins
寻找一下rabbitmq-plugins的位置
2.切换到rabbitmq-plugins的当前目录,
比如 cd /usr/lib/rabbitmq/bin
启动插件服务
root@luochangjian-System-Product-Name:/usr/lib/rabbitmq/bin# sudo ./rabbitmq-plugins enable rabbitmq_management
Plugin configuration unchanged.
即完成插件安装。安装完成后重启RabbitMQ,打开浏览器。输入 http://127.0.0.1:55672,打开页面要求输入用户名密码,用默认的guest/guest即可。
注:若页面找不到,可通过netstat命令检查下端口号是否正确。
ubuntu下手动安装php-amqp模块教程的更多相关文章
- Ubuntu下手动安装vscode
Ubuntu下手动安装vscode1.下载vscodewget https://vscode.cdn.azure.cn/stable/553cfb2c2205db5f15f3ee8395bbd5cf0 ...
- Ubuntu下手动安装NextCloud
安装环境:阿里云VPS Ubuntu 16.04 一. 安装Apache2 sudo apt-get install apache2 安装完成后,浏览器访问http://your ip/,出现It ...
- Linux(ubuntu)下手动安装 firefox 6 并且添加快捷方式图标
Mozilla 正式发布了Firefox 6,如果你的电脑上还在用非常古老的版本么,赶紧过来更新下吧,由于官网上面只是提供了linux下的.bz2的压缩包,没有deb或者rmp格式,所以需要自己安装下 ...
- Ubuntu下手动安装VMware Tools步骤
To mount the CD image and extract the contents: Power on the virtual machine. Log in to the virtual ...
- Ubuntu下手动安装Nvidia显卡驱动
1. 下载最新版的nVidia驱动. http://www.nvidia.com/page/drivers.html 2.编辑blacklist.conf. sudo gedit /etc/modpr ...
- centos或ubuntu下手动安装jdk8
https://blog.csdn.net/pang_ping/article/details/80570011 https://blog.csdn.net/u012707739/article/de ...
- Ubuntu 14.04 下手动安装Firefox的Flash插件
有时候我们不得不採用手动安装一些软件. Ubuntu 14.04 下手动安装Firefox的Flash插件有下面几步 1. 下载Flash插件 下载地址为http://get.adobe.com/cn ...
- Torch7在Ubuntu下的安装与配置
Torch7的本系列教程的主要目的是介绍Torch的入门使用.今天首先分享一下Torch7的安装.(在Ubuntu14.04安装torch7) 为什么选择Torch Torch的目标是在建立科学算法的 ...
- Deepin系统手动安装oracle jdk8详细教程
Deepin系统手动安装oracle jdk8详细教程 oracle官网下载jdk压缩包,使用 sudo tar -zxf jdk***解压文件,我放在在了home/diy/java/jdk路径下. ...
随机推荐
- [ilink32 Error] Fatal: Unable to open file 'DATA.DBXMSSQLMETADATAREADER.OBJ'
[ilink32 Error] Fatal: Unable to open file 'DATA.DBXMSSQLMETADATAREADER.OBJ' 清除重新编译OK
- System.Types.hpp(77): E2029 'TObject' must be a previously defined class or struct
System.Types.hpp System.Types.hpp(77): E2029 'TObject' must be a previously defined class or struct ...
- ESXi 上创建CentOS虚拟机
之前介绍了ESXi上添加存储.本篇介绍一下在ESXi上创建CentOS虚拟机. 方法/步骤 登陆ESXi,选择“创建/注册虚拟机” 选择“创建新的虚拟机” 给装的虚拟机命名,并选择操作系统及版本 ...
- Java设计模式——合成/聚合复用原则
一.什么是合成/聚合复用原则? 合成/聚合复用原则是在一个新的对象里面使用一些已有的对象,使之成为新对象的一部分:新的对象通过向这些对象的委派达到复用已有功能的目的. 简述为:要尽量使用合成/聚合,尽 ...
- JSP页面java代码报错:Purgoods cannot be resolved to a type
错误提示 : Purgoods cannot be resolved to a type Purgoods不能解析为一个类型 原因 : 缺少引入Purgoods类 页面中引入java类,执行java代 ...
- Leetcode 题解 reverse List II
这个题确实太容易错了. 我已经做了2遍了,之前都是套用reverse List 1中的函数. 现在尝试用新方法,在一个函数里完成,结果又错了. 事实证明,永远不要想当然!!!白板编程真的是要求,你对每 ...
- BroadcastReceiver的使用,动态注册和注销,优先级和中断控制
BroadcastReceiver: BroadcastReceiver(广播接收器)是Android中的四大组件之一,用来通知某些事件的相关信息,如下载完成,设置改变等. 默认的BroadcastR ...
- Linux:客户端的实现
写了一个简单的服务器软件,但是没有写客户端.现在我将客户端实现了,其实昨天已经说了客户端的实现步骤了. 步骤: socket() 初始化 connet()链接 从标准输入读数据fgets() 传数据到 ...
- How to Pronounce the Months of the Year
How to Pronounce the Months of the Year Share Tweet Share Tagged With: Most Popular Some of the mont ...
- C++17尝鲜:变长 using 声明
using 声明 先来看 using 声明在类中的应用: 代码1 #include <iostream> using namespace std; struct A { void f(in ...