Home >Backend Development >PHP Tutorial >PHP extension AMQP, installation error resolution
The content of this article is about php extension AMQP, installation error resolution, and has certain reference value. Now I share it with everyone. Friends in need can refer to it
There are two places where errors are likely to occur. One is that the version of rabbitmq-c is incorrect, and the other is that lib64 needs to find the right path when performing ln.
Reference URL:
https://segmentfault.com/a/1190000012348103
https://blog.csdn.net/qq_35772366/article/details/78932367
#root账号 yum install gcc glibc-devel make ncurses-devel openssl-devel xmlto #非root账号 wget http://erlang.org/download/otp_src_18.3.tar.gz tar xvf otp_src_18.3.tar.gz #配置 '--prefix'指定的安装目录 ./configure --prefix=/usr/local/erlang --with-ssl -enable-threads -enable-smmp-support -enable-kernel-poll --enable-hipe --without-javac #安装 make && make install #配置erlang环境变量 vim /etc/profile #在文件末尾添加下面代码 'ERLANG_HOME'等于上一步'--prefix'指定的目录 ERLANG_HOME=/usr/local/erlang PATH=$ERLANG_HOME/bin:$PATH export ERLANG_HOME export PATH #使环境变量生效 source /etc/profile #输入命令检验是否安装成功 erl #如下输出表示安装成功 # # wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.1/rabbitmq-server-generic-unix-3.6.1.tar.xz #RabbitMQ3.6版本无需make、make install 解压就可以用 #解压rabbitmq,官方给的包是xz压缩包,所以需要使用xz命令 xz -d rabbitmq-server-generic-unix-3.6.1.tar.xz #xz解压后得到.tar包,再用tar命令解压 tar -xvf rabbitmq-server-generic-unix-3.6.1.tar #移动目录 看个人喜好 cp -rf ./rabbitmq_server-3.6.1 /usr/local/ cd /usr/local/ #修改文件夹名 mv rabbitmq_server-3.6.1 rabbitmq-3.6.1 #开启管理页面插件 cd ./rabbitmq-3.6.1/sbin/ ./rabbitmq-plugins enable rabbitmq_management #启动命令,该命令ctrl+c后会关闭服务 #./rabbitmq-server #在后台启动Rabbit #./rabbitmq-server -detached #关闭服务 #./rabbitmqctl stop #关闭服务(kill) 找到rabbitmq服务的pid [不推荐] #ps -ef|grep rabbitmq #kill -9 **** #添加管理员账号 #进入RabbitMQ安装目录 cd /usr/local/rabbitmq-3.6.1/sbin #添加用户 #rabbitmqctl add_user Username Password ./rabbitmqctl add_user rabbitadmin 123456 #分配用户标签 #rabbitmqctl set_user_tags User Tag #[administrator]:管理员标签 ./rabbitmqctl set_user_tags rabbitadmin administrator #http://192.168.70.128:15672/ # # # #PHP Version 5.5.7 # # # # 安装rabbitmq-c wget https://github.com/alanxz/rabbitmq-c/releases/download/v0.5.2/rabbitmq-c-0.5.2.tar.gz https://github.com/alanxz/rabbitmq-c/archive/v0.5.2.tar.gz 在安装amqp之前还需要安装另外一个通讯扩展rabbitmq-c。 去github下载最新版本(目前是0.8.0)的源码包并解压缩。 tar -zxvf rabbitmq-c-0.5.2.tar.gz -C .rabbitmq-c-0.5.2 cd rabbitmq-c-0.5.2/ mkdir build && cd build #这一步是在rabbitmq-c的根目录下创建一个build子目录 # 这一步是让cmake根据../CMakeList.txt,即rabbitmq-c的根目录下的CMakeList.txt创建Makefile文件 # Makefile文件会被创建到build目录中 # yum install cmake # cmake --version cmake -DCMAKE_INSTALL_PREFIX=/usr/local/rabbitmq-c .. # 这一步是真正的build rabbitmq-c库的,注意,不要漏掉点 '.' cmake --build . --target install cd /usr/local/rabbitmq-c & ln -s lib64 lib 安装amqp 从pecl官方库中下载最新的amqp扩展包 wget http://pecl.php.net/get/amqp-1.4.0.tgz tar -zxvf amqp-1.4.0.tgz cd amqp-1.4.0 /alidata/server/php/bin/phpize ./configure --with-php-config=/alidata/server/php/bin/php-config --with-amqp --with-librabbitmq-dir=/usr/local/rabbitmq-c make && make install 配置amqp扩展 vi /alidata/server/php/etc/php.ini 添加 extension=amqp.so #重启 php php-fpm -v killall php-fpm && /alidata/server/php/sbin/php-fpm &
Related recommendations:
Introduction to phpize, the automatic management tool for PHP extensions
CentOS7 php installation amqp extension
When PHP installs amqp extension, librabbitmq is not installed error
The above is the detailed content of PHP extension AMQP, installation error resolution. For more information, please follow other related articles on the PHP Chinese website!