PHP 5.6与Mysqli_connect [英] PHP 5.6 with Mysqli_connect

查看:448
本文介绍了PHP 5.6与Mysqli_connect的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们最近更新了PHP到最新版本,我们有一个正在运行的php脚本现在破了。

We recently updated PHP to the latest version, and we had a php script that was running that is now broke.

目前,它甚至不允许我连接到SQL数据库,并返回此错误:无法连接到MySQL:无法连接到MySQL服务器在mysql01.fau.edu(13)2003。

Currently, it is not even allowing me to connect to the SQL database at all, and is returning this error: "Failed to connect to MySQL: Can't connect to MySQL server on mysql01.fau.edu (13) 2003".

数据库本身位于linux环境中,我目前无法获得一个简单的脚本下面运行:

The database itself is located in a linux environment and I currently cannot get even a simple script as the one below running:

$host = 'mysql01.fau.edu';
$username = '*****';
$password = '*****';
$database = '******';
$connect = mysqli_connect($host,$username,$password,$database);

if (mysqli_connect_errno()) {
    echo 'Failed to connect to MySQL: ' . mysqli_connect_error() . mysqli_connect_errno();
} else {
    echo 'Connected to MySQL! </ br>';
}

任何帮助将非常感谢。谢谢!

Any help would be greatly appreciated. Thank you!

推荐答案

出于安全目的,默认情况下,Mysql不能远程访问,除非将后端允许的IP列入白名单。

For security purposes Mysql is not remotely accessible by default, unless you whitelist the allowed IP in the backend.

您提到它曾经在您的笔记本电脑上工作,很可能会改变IP。

You have mentioned it used to work on your laptop which could very possibly change IP.

网络工作时

这篇关于PHP 5.6与Mysqli_connect的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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