How to solve MQTT connection error in laravel - php

I am facing this issue : production.ERROR: PhpMqtt\Client\Exceptions\ConnectingToBrokerFailedException: [1000] Establishing a connection to the MQTT broker failed: Socket error [111]: Connection refused in
here is my env config
MQTT_HOST="broker.hivemq.com"
MQTT_PORT=1883
MQTT_ENABLE_LOGGING=false

Related

php artisan make controller command try connecting to mysql and throwing connection error

when i run any php artisan commands make,key its throwing an error saying
In Connection.php line 664:
SQLSTATE[HY000] [2002] No connection could be made because the
target machine actively refused it. (SQL: select * from system
where key = woocommerce_version limit 1)
In Connector.php line 70:
SQLSTATE[HY000] [2002] No connection could be made because the
target machine actively refused it.
why it tries to connect to mysql database it has nothing to do with it
my server is iis i don't know if its mis-configured, but the same laravel application in localhost shows no error

MongoDB + PHP: Error "Failed to connect to 127.0.0.1:27017"

I have running a EC2 instance with MongoDB and some .php files to deploy a little webpage.
PHP shows productos taken from MongoDB.
<?php
include_once("header.php");
require 'vendor/autoload.php';
$uri="mongodb://localhost";
$client=new MongoDB\Client($uri);
$collection = $client->tienda->categorias->find();
$categorias=array();
When I created DB it was no problem. After a new login to EC2 webpage doesn't show anything from DB.
When I try to check DB this error returns:
> use tienda
> show collections
2020-05-13T17:29:29.612+0000 I NETWORK [thread1] trying reconnect to 127.0.0.1:27017 (127.0.0.1) failed
2020-05-13T17:29:29.612+0000 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
2020-05-13T17:29:29.612+0000 I NETWORK [thread1] reconnect 127.0.0.1:27017 (127.0.0.1) failed failed
2020-05-13T17:29:29.612+0000 E QUERY [thread1] Error: socket exception [CONNECT_ERROR] for couldn't connect to server 127.0.0.1:27017, connection attempt failed :
runClientFunctionWithRetries#src/mongo/shell/session.js:346:31
runCommand#src/mongo/shell/session.js:412:25
DB.prototype._runCommandImpl#src/mongo/shell/db.js:145:16
DB.prototype.runCommand#src/mongo/shell/db.js:161:20
DB.prototype._getCollectionInfosCommand#src/mongo/shell/db.js:930:19
DB.prototype.getCollectionInfos#src/mongo/shell/db.js:953:19
DB.prototype.getCollectionNames#src/mongo/shell/db.js:964:16
shellHelper.show#src/mongo/shell/utils.js:809:9
shellHelper#src/mongo/shell/utils.js:706:15
#(shellhelp2):1:1
2020-05-13T17:24:05.117+0000 I NETWORK [thread1] trying reconnect to 127.0.0.1:27017 (127.0.0.1) failed
2020-05-13T17:24:05.117+0000 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
2020-05-13T17:24:05.117+0000 I NETWORK [thread1] reconnect 127.0.0.1:27017 (127.0.0.1) failed failed
After some google hours the only way I found to keep DB working is running on a new tab
$ mongod
Once I close this tab, DB stops to work and webpay stops to display products.
Is there any way to fix this?
I'm new to MongoDB btw.
You can run the MongoDB process as a daemon
mongod --fork --logpath /var/log/mongodb/mongod.log
Where logpath is where logs will be saved.
Documentation:
https://docs.mongodb.com/manual/tutorial/manage-mongodb-processes/

Mysql Remote Connection Failed

Im trying with php to connect my remote server's mysql im getting this error:
"Database Connection Error: SQLSTATE[HY000] [2002] connection refused"
I made what said in that page : https://www.configserverfirewall.com/ubuntu-linux/enable-mysql-remote-access-ubuntu/
this is my setting now:
and ofcourse restarted mysql.
ANd its still saying same error "Database Connection Error: SQLSTATE[HY000] [2002] connection refused"
What can i do else?
this is my connection setting:
When i try port 3306 same error. What can cause that?
ps: also this is a remote connection from a hosting shared to my dedicated server
it was about cloudflare or other proxies. Fixed.

MySQL randomly says SQLSTATE[HY000] [2002] Connection Refused

Using PHP, Symfony Framework, MySQL.
Switched to new server.
System randomly triggers SQLSTATE[HY000] [2002] Connection refused. Does this related to server/database setting?
Database setting adjusted:
max_allowed_packet: 268435456

SoapClient: What's the difference between "Could not connect to host", "Network is unreachable" and "Connection timed out"

I have some php exception logs where some say "Connection timed out", other logs say "Network is unreachable" and even other logs say "Could not connect to host"
What's the difference between the three messages + I'm wondering if SoapClient throws the default "Exception" or does it throw a "SoapFault"?
These are the exact error messages for both errors:
SoapClient::__doRequest(): connect() failed: Network is unreachable
SoapClient::__doRequest(): connect() failed: Connection timed out
Could not connect to host
Thanks.

Categories