Mosquitto-PHP Library in raspberry and windows

admin

Administrator
Staff member
I install PHP client for MQTT using Mosquitto-PHP

Library in raspberry
<a href="http://wingsquare.com/blog/developing-php-client-for-mqtt-using-mosquitto-php-library" rel="nofollow">mosquitto php library</a>/

after that create pub.php in
Code:
/var/www/html/mqtt
when write in browser
Code:
http://xxx.xxx.xxx.xx/mqtt/pup.php
and no see any data

I then tried

Code:
$mosquitto_pub -h localhost -t "/mqtt" -m "HelloWorld"

and the get

Code:
bash: -h: command not found

I don't know where the problem is, for information write in command

Code:
$mosquitto -v
1464002857: mosquitto version 1.4.8 (build date Tue, 17 May 2016 11:26:59 +0100) starting
1464002857: Using default config.
1464002857: Opening ipv4 listen socket on port 1883.
1464002857:Error: Address already in use

I also have the same problem in my windows I install mosquitto, see this link <a href="https://sivatechworld.wordpress.com...ing-and-configuring-mosquitto-with-windows-7/" rel="nofollow">step-by-step-installing-and-configuring-mosquitto-with-windows-7</a>

I see the service for Mosquitto Broker(MQTT v3.1 broker) is runnng and
check the example pub.php to testing the result is error
Code:
Mosquitto\Client()
is not found

I searched and found mosquitto.php and put the I put this code in pub.php

Code:
require "mosquitto.php";

I don't know where the problem is, can any one help me to running mosquitto in my windows and raspberry.

I need to try mqtt connected with localhost and check connection is OK or not also to subscribe and publish and reading the message