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

问题描述

首先,是的,我知道有一个非常类似的问题在那里,但给出的答案也并不适用于我的情况,而且也没有迹象表明它是固定其他人的问题。

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.

我有我的Apache服务器上安装了ZMQ,根据Racthet文档中的教程。我很多的挫折后,成功安装了一切,我准备运行一个例子。简单的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

我已经包括扩展= zmq.so 我的只有的使用php.ini文件的末尾,作为zeromq文件建议。为了确保Apache是​​加载相同的php.ini的页面,我检查。阿帕奇给了我完全相同的信息在页面上运行的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 code做了它的作用。所以,我已经消除了唯一可能的根本原因,我已经在我的搜索,到目前为止发现的,我找一个替代。

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 "\")

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

08-13 10:32