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路径下. ...
随机推荐
- 快速掌握和使用Flyway
什么是Flyway? 转载:https://blog.waterstrong.me/flyway-in-practice/ Flyway is an open-source database migr ...
- python_03 各种运算符
1.算数运算 2.比较运算 3.赋值运算 4.逻辑运算 先计算括号中表达式 计算顺序:and,or,not在一个表达式中从前到后计算, 若and前一个元素为false则立刻返回为False,不计算后面 ...
- jetty 入门
jetty因其能作为内嵌的应用服务器,随应用一起存在,在小批量应用中很受欢迎. jetty作为应用服务器: jetty下载: 在官网下载jetty:http://www.eclipse.org/jet ...
- 获取本机内网、外网ip(C++)<转>
基础知识 电脑在局域网内,通过网关/路由器连接到Internet则ip分为内网ip.外网ip.通过ipconfig得到的为局域网ip. 电脑直接拨号连接等,则本机通过ipconfig得到的就是外网ip ...
- echarts-颜色渐变
图形的颜色. 默认从全局调色盘 option.color 获取颜色 颜色可以使用 RGB 表示,比如 'rgb(128, 128, 128)',如果想要加上 alpha 通道表示不透明度,可以使用 R ...
- ubuntu 安装 oracle sql developer
安装java-jdk 这一部分教程很多,可按照网上教程进行安装 安装sqldeveloper 下载 sqldeveloper Linux RPM http://www.oracle.com/techn ...
- mysql 字符串数字转换
1 方法一:SELECT CAST('123' AS SIGNED); 2 方法二:SELECT CONVERT('123',SIGNED); 3 方法三:select '123'+1
- .NET 基础知识
.net程序基本编写.执行流程(c#) 1>编写c#代码,保存为.cs文件. 2>通过csc.exe程序来将.cs文件编译为.net程序集(.exe或.dll).此 ...
- git 恢复到旧版本命令
1.第一步:找到你想恢复到的版本号:可以在git提交日志中查看-> 找到版本号,复制下来,在git项目根目录下打开git命令窗口: 输入:git reset --hard xxxxxxxxxxx ...
- IE 11中 onpropertychange失效
https://msdn.microsoft.com/zh-cn/library/ie/dn265032(v=vs.85).aspx 将突变事件和属性更改事件迁移到突变观察者 Internet Exp ...