linux下安装php扩展amqp
1 安装扩展必要依赖 rabbitmq-c
安装包地址:https://github.com/alanxz/rabbitmq-c/releases
wget -c https://github.com/alanxz/rabbitmq-c/releases/download/v0.8.0/rabbitmq-c-0.8.0.tar.gz tar zxf rabbitmq-c-0.8.0.tar.gz cd rabbitmq-c-0.8.0 ./configure --prefix=/usr/local/rabbitmq-c-0.8.0 make && make install
2 安装amqp
官网:http://pecl.php.net/package/amqp
wget -c http://pecl.php.net/get/amqp-1.9.3.tgz tar zxf amqp-1.9.3.tgz cd amqp-1.9.3 /usr/local/php/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config --with-amqp --with-librabbitmq-dir=/usr/local/rabbitmq-c-0.8.0 make && make install
3.php.ini 添加模块
vi /usr/local/php/etc/php.ini
增加
extension = /usr/local/php/lib/php/extensions/no-debug-non-zts-20151012/amqp.so
4 重启服务器或PHP服务
查看phpinfo();
以上步骤完成扩展的安装。