使用PHP实现MQTT Mosquitto客户端..在终端上工作..但不在浏览器中

时间:2016-08-01 11:19:56

标签: php mqtt mosquitto

M使用PHP在MQTT Mosquitto客户端上工作。 首先安装mosquitto扩展到我的PHP 将extension = mosquitto.so添加到我的php.ini文件中 重启apache服务器

现在我面临着蚊子扩展的问题

在终端上运行脚本,我发现它完全正常工作 但是在浏览器上运行时我找到了

致命错误:Class' Mosquitto \ Client'在第7行的/var/www/html/sub.php中找不到

挖掘更多我写了一个php脚本来打印所有扩展并通过终端和浏览器执行它。结果是

Image for terminal

image for browser

Mosquitto扩展不适用于浏览器,但它适用于终端..

请帮助..提前多多感谢..

2 个答案:

答案 0 :(得分:0)

我们在ubuntu中有两个php.ini文件“ /etc/php5/apache2/php.ini”和“ /etc/php5/cli/php.ini” 确保在/etc/php5/apache2/php.ini中也添加了extension = mosquitto.so

答案 1 :(得分:0)

只需使用以下命令来确认php.ini的位置:

File "/home/pohsuanh/Documents/flownet2-tf/src/flownet_c/flownet_c.py", line 69, in model concat5 = tf.concat([conv5_1, deconv5, upsample_flow6to5], axis=3) File "/home/pohsuanh/miniconda3/envs/flownet/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 1124, in concat return gen_array_ops.concat_v2(values=values, axis=axis, name=name) File "/home/pohsuanh/miniconda3/envs/flownet/lib/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py", line 1033, in concat_v2 "ConcatV2", values=values, axis=axis, name=name) File "/home/pohsuanh/miniconda3/envs/flownet/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "/home/pohsuanh/miniconda3/envs/flownet/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 488, in new_func return func(*args, **kwargs) File "/home/pohsuanh/miniconda3/envs/flownet/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3272, in create_op op_def=op_def) File "/home/pohsuanh/miniconda3/envs/flownet/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1790, in __init__ control_input_ops) File "/home/pohsuanh/miniconda3/envs/flownet/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1629, in _create_c_op raise ValueError(str(e)) ValueError: Dimension 1 in both shapes must be equal, but are 23 and 24. Shapes are [1,23,40] and [1,24,40]. for 'FlowNet2/FlowNetCSS/FlowNetCS/FlowNetC/concat_1' (op: 'ConcatV2') with input shapes: [1,23,40,512], [1,24,40,512], [1,24,40,2], [] and with computed input tensors: input[3] = <3>.

结果:

php --ini

在此处添加扩展名 并重新启动PC上的蚊子和服务器。...(Reference