本地主机php_network_getaddresses:的getaddrinfo失败:没有这样的主机已知 [英] Localhost php_network_getaddresses: getaddrinfo failed: No such host is known
问题描述
我使用localhost UNISERVER,运行Apache和MySQL。 (没有用户名和密码)
我有code 新的mysqli(HTTP://本地主机/ us_phpmyadmin /,,,url_short);
连接到我的本地主机服务器,但是当我尝试运行code mysqli_query(INSERT INTO cut.it VALUES(NULL,$ longurl,$ SHORTURL));
,误差 php_network_getaddresses:的getaddrinfo失败:没有这样的主机被称为
在页面上出现。这是为什么,我该如何解决呢?
I am using Localhost with UniServer, running Apache and MySQL. (There is no username or password)
I have the code new mysqli("http://localhost/us_phpmyadmin/","","","url_short");
to connect to my Localhost server, but when I try to run the code mysqli_query("INSERT INTO cut.it VALUES (NULL, $longurl, $shorturl)");
, the error php_network_getaddresses: getaddrinfo failed: No such host is known.
comes up on the page. Why is this and how can I get around it?
推荐答案
您必须指定MySQL实例的主机名不phpMyAdmin的一个网址。
You have to specify the hostname of MySQL instance not a url for phpMyAdmin.
修改
... mysqli("http://localhost/us_phpmyadmin/","","","url_short");
到
... mysqli("localhost", "", "", "url_short");
^^^^^^^^^
这篇关于本地主机php_network_getaddresses:的getaddrinfo失败:没有这样的主机已知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!