The other day I purchased a DigitalOcean Managed Database to use as a secondary MySQL server to reduce load on our primary CPanel CentOS server.
This has worked great but every couple of hours our error logs from our PHP scripts fill with the following errors:
[24-Jan-2022 04:16:21 UTC] PHP Warning: mysqli::__construct(): php_network_getaddresses: getaddrinfo failed: Name or service not known
[24-Jan-2022 04:16:21 UTC] PHP Warning: mysqli::__construct(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known
[24-Jan-2022 04:16:21 UTC] PHP Warning: mysqli_set_charset(): Couldn't fetch mysqli
[24-Jan-2022 04:16:21 UTC] PHP Warning: mysqli::prepare(): Couldn't fetch mysqli
[24-Jan-2022 04:16:21 UTC] PHP Fatal error: Uncaught Error: Call to a member function bind_param() on null
These errors are originating on this line:
$db = new mysqli("ygo-external-database-do-user-10645539-0.b.db.ondigitalocean.com:25060","username","password", "database");
I don't think it's a firewall issue since it is working most of the time. The website is also using Cloudflare but I don't think that is the issue either as I paused Cloudflare once when it occurred and the issue remained for ~20 minutes or so. Restarting the Litespeed web server tends to fix this immediately but I am non the wiser as to why this is happening.
Related
I have looked everywhere for a fix, but could only find ones for localhost or private sites.
I keep getting this error:
Failed to connect to MySQL: Can't connect to MySQL server on 'sql306.juichost.ml' (113 "No route to host")
The website is Here. I am using this website host for mysql, but hostmonster for the actual hosting.
I have tried ping sql306.juichost.ml and gotten this:
ping: sendto: Host is down
Request timeout for icmp_seq 876.
I have no idea what to that means though.
In the error log I see:
[01-Nov-2017 09:52:56 UTC] PHP Warning: include(): Failed opening 'inc/database.php' for inclusion (include_path='.:/opt/alt/php56/usr/share/pear:/opt/alt/php56/usr/share/php') in /home/aussieug/public_html/ppyazi/license/login.php on line 2
And
[01-Nov-2017 09:52:56 UTC] PHP Notice: Undefined variable: con in /home/aussieug/public_html/ppyazi/license/login.php on line 14
Line 2:
include 'inc/database.php';
Line 14:
$checksettings = mysqli_query($con, "SELECT * FROM `settings` LIMIT 1") or die(mysqli_error($con));
Please keep in mind that I am very new to terminal and php so I need detailed answers.
Ive set up phpmyadmin and mySql on my windows server but when i try to connect via php i get this error :
Warning: mysqli::mysqli(): MySQL server has gone away in C:\xampp\htdocs\newservertest\dbscripts\sqlconnection.php on line 5
Warning: mysqli::mysqli(): Error while reading greeting packet. PID=15852 in C:\xampp\htdocs\newservertest\dbscripts\sqlconnection.php on line 5
Warning: mysqli::mysqli(): (HY000/2006): MySQL server has gone away in C:\xampp\htdocs\newservertest\dbscripts\sqlconnection.php on line 5
Catchable fatal error: Object of class mysqli could not be converted to string in C:\xampp\htdocs\newservertest\dbscripts\sqlconnection.php on line 14
I know by default mySql only allows local connections but following tutorials online they are all saying to uncomment a line in a "my.ini" file. All i have in my sql folder is a my-default.ini with the following :
How can i open this up to connections from an external php script?
Try adding this to your php.ini:
mysqli.reconnect = 1
I am building a new WordPress site for a client and all of a sudden today I am seeing this error at the top of the screen. I have never seen this before. Any ideas what could be causing this to happen now? Also how to fix it?
Warning: stream_socket_client(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/wp-includes/class-http.php on line 787
Warning: stream_socket_client(): unable to connect to tcp://www.MY-DOMAIN.com:80 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /var/www/wp-includes/class-http.php on line 787
Not sure if you are using a VM but when I had this error I resolved it by adding an entry to my hosts file in my vagrant machine that pointed back to localhost.
127.0.0.1 www.MY-DOMAIN.com
I am following step-by-step guide of google app engine "Using the User Service", but after I ran the app server locally
C:\Users\xxx>dev_appserver.py --php_exectuable_path="C:\Users\xxx\Desktop\php54\php-cgi.exe" C:\Users\xxx\Desktop\FirstPhpPrj\
below errors pop up:
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed:
No such host is known. in <b>C:\Users\xxx\Desktop\google_appengine\php\sdk\
google\appengine\runtime\RemoteApiProxy.php</b> on line 92
Warning:
file_get_contents(http://localhost:51089)
: failed to open stream:
php_network_getaddresses: getaddrinfo failed: No such host is known. in C
:\Users\xxx\Desktop\google_appengine\php\sdk\google\appengine\runtime\RemoteApiP
roxy.php on line 92
Fatal error: Uncaught exception 'google\net\ProtocolBufferDecodeError'
with message 'Not initialized: login_url' in C:\Users\xxx\Desktop\google_appengin
e\php\sdk\google\appengine\runtime\proto\ProtocolMessage.php:121
Stack trace:
#0 C:\Users\xxx\Desktop\google_appengine\php\sdk\google\appengine\runtime\proto\
ProtocolMessage.php(88): google\net\ProtocolMessage->mergeFromString('')
#1 C:\Users\xxx\Desktop\google_appengine\php\sdk\google\appengine\runtime\Remote
ApiProxy.php(109): google\net\ProtocolMessage->parseFromString('')
#2 C:\Users\xxx\Desktop\google_appengine\php\sdk\google\appengine\runtime\ApiProxy.php(42): google\appengine\runtime\RemoteApiProxy->makeSyncCall('user', 'CreateLoginURL', Object(google\appengine\CreateLoginURLRequest), Object(google\app
engine\CreateLoginURLResponse), NULL)
#3 C:\Users\xxx\Desktop\google_appengine\php\sdk\google\appengine\api
\users\UserService.php(69): google\appengine\runtime\ApiProxy::makeSyncCall('user', 'CreateLoginURL', Object(google\appengine\CreateLoginURLRequest), Object(google in C
:\Users\xxx\Desktop\google_appengine\php\sdk\google\appengine\runtime\proto\ProtocolMessage.php on line 121
I browsed the log, there are two warnings and one fatal error. But not after I looked thru the coding of php sdk, i realized that this fatal error, caused by empty string input in "mergeFromString", is in fact caused by the warnings of"
file_get_contents(http://localhost:51089)
no such host is known", because in RemoteApiProxy.php, function CreateLoginURLResponse:
$serialized_remote_respone = file_get_contents(
'http://localhost:' . $this->apiPort, false, $context);
once serialized_remote_response gets an empty result, it will affect the command in next line:
$remote_response->parseFromString($serialized_remote_respone);
In this case, my own codes are actually irrelevant as it is exactly the same as the google sample codes:here.
I just want to figure out why on earth, after google app engine starts its API server at
http://localhost:51089
yet it is not recognized! I tried pin this host and windows also threw error!
i am having a problem with PHP file_get_contents.
$html = file_get_html($csfd_link);
Writes an error:
Warning: file_get_contents() [function.file-get-contents]:
php_network_getaddresses: getaddrinfo failed: Name or service not
known in /home/vo003500/www_root/admin/simple_html_dom.php on line 76
Warning: file_get_contents(http://www.example.com/)
[function.file-get-contents]: failed to open stream:
php_network_getaddresses: getaddrinfo failed: Name or service not
known in /home/vo003500/www_root/admin/simple_html_dom.php on line 76
I do not know what it is. The server is allow_url_fopen ON
Thanks
Edit:
Until now it worked, but the last 2 weeks not working...
It looks like your suffering from DNS (Domain Name Service) resolution error. Make sure there is a proper DNS server entry in /etc/resolv.conf.