Database connection fail when trying to connect database at google app engine - php

Database connection fail when trying to connect database at google app engine
error_reporting(E_ALL);
ini_set("display_errors", 1);
$con = mysql_connect('<host>','<username>','<password>') or die(mysql_error());
I got error message.
Warning: mysql_connect(): php_network_getaddresses: gethostbyname
failed. errno=0 in
/base/data/home/apps/s~testappgraymatics/1.388814076593258081/helloworld.php
on line 7 Warning: mysql_connect(): php_network_getaddresses:
gethostbyname failed. errno=0 in
/base/data/home/apps/s~testappgraymatics/1.388814076593258081/helloworld.php
on line 7 php_network_getaddresses: gethostbyname failed. errno=0

Related

Occasional "php_network_getaddresses: getaddrinfo failed" connecting to DigitalOcean Managed Database

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.

error in file get contents and var_dump

i use this code:
<?php
$token="683911895:AAGGVHW_RdP9h4dfvXYPABJe-RGdfyj125g";
$url="https://api.telegram.org/bot" . $token . "/getupdates";
$content=file_get_contents($url);
var_dump ($content);
?>
but it have 2 errors:
1:
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: A non-recoverable error occurred during a database lookup. in C:\wamp\www\tbot.php on line 5
2:
Warning: file_get_contents(https://api.telegram.org/bot683911895:AAGGVHW_RdP9h4dfvXYPABJe-RGdfyj125g/getupdates): failed to open stream: php_network_getaddresses: getaddrinfo failed: A non-recoverable error occurred during a database lookup. in C:\wamp\www\tbot.php on line 5
and telegram is ban in my country
check php settings "allow_url_fopen = On"
check the usage here http://www.php.net/manual/en/function.file-get-contents.php
if it still will not connect then you have an issue with the URL or DNS on your server.

mysqli_connect(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: No such host is known

I am trying to connect my local PHP program from one PC and Mysql from a server or another PC. But I got following error when I tried this
Warning: mysqli_connect(): php_network_getaddresses: getaddrinfo failed: No such host is known. in D:\xampp\htdocs\bharat\bharat\connect.php
Warning: mysqli_connect(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: No such host is known. in D:\xampp\htdocs\bharat\bharat\connect.php
Warning: mysqli_error() expects parameter 1 to be mysqli, string given in D:\xampp\htdocs\bharat\bharat\connect.php
<?php
$con = mysqli_connect('https://192.168.43.215', 'root', '12345678', 'bharat') or die(mysqli_error("Error connection"));
I tried to keep mysql database in remote server for data security and software in local machine. Can any one tell me the exact way. Thank you.
You don't need the https://, this would be sufficient:
<?php
$con = mysqli_connect('192.168.43.215', 'root', '12345678', 'bharat') or die(mysqli_error("Error connection"));

Webhost firewall blocking paypal ipn ssl?

Error log:
[07-Mar-2016 23:26:23 Europe/Moscow] PHP Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/domeofli/public_html/test/payments.php on line 81
[07-Mar-2016 23:26:23 Europe/Moscow] PHP Warning: fsockopen(): unable to connect to ssl://www.paypal.com:443 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /home/domeofli/public_html/test/payments.php on line 81
[07-Mar-2016 23:30:40 Europe/Moscow] PHP Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/domeofli/public_html/test/payments.php on line 81
[07-Mar-2016 23:30:40 Europe/Moscow] PHP Warning: fsockopen(): unable to connect to ssl://www.paypal.com:443 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /home/domeofli/public_html/test/payments.php on line 81
Line 81:
$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);
So, what do you think? Could it be my dodgy web host (it's very dodgy, i'm just here for the low price of $5 a year lol), i tested out my script about 5-10 times and only once did my information get sent into the database (5 minutes later).
thanks.
OpenSSL library has to be installed to open ssl:// URL. Check it with a phpinfo() call.

Connection to my sql data base

First, let me note that the connection infomation is not the correct info. I made a database on 1and1 and I want to connect to it from the web. I am not getting the syntax correct here, can someone point me in the right direction?
Here is what I have:
//connect to DB
$dbc=mysql_connect('http://db232154114.db.1and1.com','db232154114','password');
mysql_select_db('tableName',$dbc)
Here are the errors that I am getting:
Warning: mysql_connect() [function.mysql-connect]: php_network_getaddresses:
getaddrinfo failed: No such host is known. in
C:\xampp\htdocs\ciss225Testing\homework\final_process.php on line 35
Warning: mysql_connect() [function.mysql-connect]: [2002] php_network_getaddresses:
getaddrinfo failed: No such host is kn (trying to connect via tcp://http:3306) in
C:\xampp\htdocs\ciss225Testing\homework\final_process.php on line 35
Warning: mysql_connect() [function.mysql-connect]: php_network_getaddresses:
getaddrinfo failed: No such host is known. in
C:\xampp\htdocs\ciss225Testing\homework\final_process.php on line 35
Warning: mysql_select_db() expects parameter 2 to be resource, boolean given in
C:\xampp\htdocs\ciss225Testing\homework\final_process.php on line 37
Try to replace http://db232154114.db.1and1.com/ with IP address of SQL server you're connecting to
Remove http:// and enable remote MySQL connections from your server's cPanel or so
your connection string is not right. get rid of the "http://" stuff; that is not part of the db server's hostname.

Categories