本地主机php_network_getaddresses:的getaddrinfo失败:没有这样的主机已知 [英] Localhost php_network_getaddresses: getaddrinfo failed: No such host is known

查看:327
本文介绍了本地主机php_network_getaddresses:的getaddrinfo失败:没有这样的主机已知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆