PHP 致命错误:类“AMQPConnection”未找到
我已经看过这个问题。这表明未安装 AMQP PECL 扩展。但是,我已经成功安装了 RabbitMQ 以及构建的 PECL AMQP 扩展。以下是 phpinfo() 的输出。
您可以清楚地看到,AMQP已正确加载。但是,当我尝试建立连接时,它显示 PHP 致命错误:未找到“AMQPConnection”类。下面是代码。
$connection = new AMQPConnection();
这是输出。
user@ubuntu:~$ php repos/default/test.php
PHP Fatal error: Class 'AMQPConnection' not found in /home/user/repos/default/test.php on line 5
为什么会发生这种情况?有什么建议吗?谢谢。
I've already seen this question. It suggests that AMQP PECL extension is not installed. However, I have successfully installed both RabbitMQ as well as built PECL AMQP extension. The following is the output of the phpinfo().
You can clearly see, AMQP is loaded correctly. However, when I try to establish a connection, it says PHP Fatal error: Class 'AMQPConnection' not found. Below is the code.
$connection = new AMQPConnection();
And here is the output.
user@ubuntu:~$ php repos/default/test.php
PHP Fatal error: Class 'AMQPConnection' not found in /home/user/repos/default/test.php on line 5
Why this might happen? Any suggestions? Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题很可能是 CLI 安装使用与 web/Apache 模块不同的 php.ini 文件,并且您还需要将扩展名添加到 CLI php.ini 文件。具体在哪里取决于您的平台。
The problem is most likely that the CLI installation uses a different php.ini file than the web/Apache module and you need to add the extension to the CLI php.ini file as well. Where exactly that is depends on your platform.