即使安装了 ZMQ,也找不到类 ZMQContext [英] Class ZMQContext not found even though ZMQ is installed

查看:29
本文介绍了即使安装了 ZMQ,也找不到类 ZMQContext的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,是的,我知道那里有一个非常相似的问题,但那里给出的答案不适用于我的情况,也没有迹象表明它解决了其他人的问题.

First of all, yes I am aware that there is a very similar question out there, but the answer given there doesn't apply to my situation, and there's no indication that it fixed the other person's problem either.

根据 Racthet 文档中的教程,我在我的 Apache 服务器上安装了 ZMQ.在经历了很多挫折之后,我成功地安装了所有东西,我准备运行一个示例.简单的 PHP 脚本放置在 post.php 中,并具有这一行(在一些相当琐碎的 PHP、设置变量等之后):

I have ZMQ installed on my Apache server, according to the tutorial found in the Racthet documentation. I installed everything successfully after a lot of frustration, and I am ready to run an example. The simple PHP script is placed in post.php and features this line (after some rather trivial PHP, setting variables etc):

$context = new ZMQContext();

然而,它抛出这个错误:

However, it throws this error:

Fatal error: Class 'ZMQContext' not found in /home/lights/public_html/apps/post.php on line 12

我在我唯一使用的 php.ini 文件的末尾包含了 extension=zmq.so,正如 zeromq 文档所建议的那样.为了确保 Apache 正在加载与页面相同的 php.ini,我进行了检查.Apache 给了我与在页面上运行 phpinfo() 完全相同的信息:

I have included extension=zmq.so at the end of my only used php.ini file, as the zeromq documentation suggested. To make sure Apache is loading the same php.ini as the page, I checked. Apache gave me exactly the same info as running phpinfo() on the page:

Configuration File (php.ini) Path   /usr/local/lib
Loaded Configuration File   /usr/local/lib/php.ini 

由此我得出结论,如果我从终端运行 php post.php 应该会出现同样的错误.但是,在这种情况下没有显示错误 - 似乎 PHP 代码发挥了作用.因此,我已经消除了迄今为止在搜索中发现的唯一可能的根本原因,我正在寻找替代方案.

From this I concluded that the same error should appear if I run php post.php from the terminal. However, no error was shown in this case - it seems the PHP code did its part. So, I have eliminated the only possible root cause that I have found in my search so far, and I am looking for an alternative.

有人有解决方案、建议、想法,或者任何可以帮助解决这个问题的东西吗?

Anyone have a solution, suggestion, idea, anything at all that could help clear this up?

推荐答案

如果启用了扩展仍然需要使用这个:

If the extension is enabled you still need to use this:

use \ZMQContext;
use \ZMQ;

(或者直接使用前导\"访问它们)

(or alternatively directly access them using a leading "\")

这篇关于即使安装了 ZMQ,也找不到类 ZMQContext的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆