mgdm / Mosquitto-PHP

A wrapper for the Eclipse Mosquitto™ MQTT client library for PHP.
BSD 3-Clause "New" or "Revised" License
531 stars 146 forks source link

wont execute PHP from web but will do so from command line #56

Open roque-lpgc opened 8 years ago

roque-lpgc commented 8 years ago

When i execute the code from the command line the message is sent correctly, but when i call the same code from a browser i get "http error 500".

PHP Code:

<?php include_once "mqtt-credentials.php";

$topic = "test";

try { $client = new Mosquitto\Client("0", true); $client->setCredentials($username, $password); $client->connect($server, $port, 60); $message = "test msg"; $client->publish($topic, $message, 1); $client->disconnect(); } catch (Exception $e) { echo $e; } ?>

roque-lpgc commented 7 years ago

The same setup works fine with Apache webserver ¿Anyone has used mosquitto.so with nginx? ... This issue is due to a bad nginx configuration.