php安装mqtt扩展【Mosquitto】

没有安装mosquitto的可以看一下链接先安装一下

MQTT服务器搭建-mosquitto1.4.4安装指南

然后我们来安装php扩展

如果你已经使用预先建立的软件包来安装Mosquitto,你需要确保你已经安装了开发头文件。在红帽派生的系统上,这可能是叫做libmosquitto-devel,在基于 Debian的系统上叫做libmosquitto-dev。

你可以使用pecl来来安装这个拓展包:

pecl install Mosquitto-alpha

或者,你也可以使用常规的安装拓展的方法来安装:

phpize
./configure --with-mosquitto=/path/to/libmosquitto
make
make install

然后添加extension=mosquitto.so到你的PHP配置文件php.ini中。

--with-mosquitto 

是可选参数,只有当安装程序找不到libmosquitto拓展包,才需要添加这个参数


git参考文档

https://github.com/mgdm/Mosquitto-PHP.git

Mosquitto-PHP 中文手册

https://www.kancloud.cn/liao-song/mosquitto-php/500401

你可能感兴趣的:(linux,php)