在unity中,我将用户名和密码传递到login.php,然后出现了“mysqlserver away”。我设置如下。
php.ini文件
post_max_size = 750M
upload_max_filezie = 750M
max_execution_time = 1200
max_input_time = 5000
memory_limit = 1000 M
max_allowed_packet = 200M
phpmyadmin/config.inc.php
+添加
$cfg ['ExecTimeLimit'] = 6000;
+添加my.ini
innodb_look_wait_timeout=600
如果我在网址中输入localhost:8080/escape\u room/login.php,结果屏幕会显示很长时间。我想就这件事征求意见。
+登录.php
<?php
$servername = "localhost:8080";
$username="root";
$password="";
$dbName="escape_room";
$user_username = $_POST['Input_user'];
$user_password = $_POST['Input_pass'];
$conn = new mysqli($servername, $username, $password, $dbName);
if(!$conn){
die("Cound not Connect: " . mysqli_connect_error());
}
$sql = "SELECT pass FROM escape_room WHERE user = '".$user_username."' ";
$result = mysqli_query($conn, $sql);
//Get the result and confirm login
$numrows = mysqli_num_rows($result);
if($numrows == 0)
{
die("ID does not exist \n");
}
else{
while($row = mysqli_fetch_assoc($result)){
if($row['pass'] == $user_password){
echo "login success";
echo $row['pass'];
}else{
echo "password incorrect";
echo "password is =". $row['pass'];
}
}
}
?>
错误如下。
mysqli :: _construct(): MySQLserver has gone away
mysqli :: _construct(): Error While reading greeting packet PID=7572
mysqli :: _construct(): (HY000/2006) : MySQL server has gone away
1条答案
按热度按时间e4yzc0pl1#
听起来像
8080
是apache配置为运行的端口,而不是mysql。您应该从连接字符串中删除:如果在自定义端口上运行它,则应将其作为连接调用的第五个参数传入。
也
127.0.0.1
对你来说可能比localhost
.