安装RabbitMQ PHP:致命错误:找不到类'AMQPConnection'

问题描述:

我已经在服务器上安装了RabbitMQ,并且一切正常.我已经尝试过使用Java客户端发送和接收排队的消息,并且一切顺利.

I've already installed the RabbitMQ on my server and everything is working fine with it. I already tried to send and receive queued messages with a Java client and everything went perfect.

现在,我需要安装PHP RabbitMQ客户端,因为我想将Java程序与PHP网页进行通信,但是这次我并不那么幸运.

Now I need to install a PHP RabbitMQ client because I want to communicate a Java program with a PHP webpage, but this time I'm not beign so lucky.

我已经按照此安装的官方网页中的步骤进行操作,具体是这些步骤:

I already followed the steps of the official webpage for this installation, specifically these steps:

# Download the rabbitmq-c library
hg clone http://hg.rabbitmq.com/rabbitmq-c/rev/3c549bb09c16 rabbitmq-c
cd rabbitmq-c
# Add the codegen requirement
hg clone http://hg.rabbitmq.com/rabbitmq-codegen/rev/f8b34141e6cb codegen
# Configure, compile and install
autoreconf -i && ./configure && make && sudo make install 

实际上,在控制台上,我可以看到它已安装",没有任何问题.但是,当我尝试打开任何AMQP连接时,都会出现此错误:

And actually on the console I can see that it was "installed" without any problems. But when I try to open any AMQP Connection I get this error:

Fatal error: Class 'AMQPConnection' not found

实际上,如果我使用phpinfo();命令,我看不到任何与AMQP模块相关的内容(例如​​此一个>问题).因此,我认为这可能是安装问题,但我尝试将其重新安装两次,并且一直说一切顺利.

Actually if I use the phpinfo(); command I can't see anything related to an AMQP module (like in this question). So I think that it may be a problem with the installation but I tried reinstalling it two times and it keeps saying that everything went well.

有人也遇到过这个问题吗?

Have anyone crossed with this problem too?

已解决..

该模块未加载到正确的 php.ini 文件中.只需在右侧 php.ini 文件的末尾添加extension=amqp.so,然后重新启动Apache.

The module wasn't being loaded in the right php.ini file. Just added extension=amqp.so at the end of the right php.ini file and restarted Apache.