PHP Fatal error: Class #39;AMQPConnection#39; not found(PHP致命错误:找不到类AMQPConnection)
问题描述
我已经看过这个问题.它表明未安装 AMQP PECL 扩展.但是,我已经成功安装了 RabbitMQ 以及构建的 PECL AMQP 扩展.以下是phpinfo()的输出.
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().
可以清楚地看到,AMQP 加载正确.但是,当我尝试建立连接时,它显示 PHP 致命错误:找不到类 'AMQPConnection'.下面是代码.
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();
这是输出.
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.
推荐答案
问题很可能是 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.
这篇关于PHP致命错误:找不到类'AMQPConnection'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:PHP致命错误:找不到类'AMQPConnection'
基础教程推荐
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- 超薄框架REST服务两次获得输出 2022-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- 在多维数组中查找最大值 2021-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01