致命错误:未捕获的异常'mysqli_sql_exception',消息'Permission denied'

时间:2017-09-08 09:26:10

标签: php mysql apache centos

在我的网页上我使用的是PHP,我在Ubuntu 16.04中运行它。

效果很好。

然后我尝试在CentOS 5.11上运行它(我知道centOS 5.11已经过时了,但出于很多原因我必须使用它。)

结果是我的网页无效。

我出现了这个错误:

Fatal error: Uncaught exception 'mysqli_sql_exception' with message 'Permission denied' in /var/www/html/IPU-GUI/website2/templates/sql_login.php:3 Stack trace: #0 /var/www/html/IPU-GUI/website2/templates/sql_login.php(3): mysqli_connect('127.0.0.1', 'root', '123456', 'ipu1') #1 /var/www/html/IPU-GUI/website2/sip.php(30): require_once('/var/www/html/I...') #2 {main} thrown in /var/www/html/IPU-GUI/website2/templates/sql_login.php on line 3

enter image description here

这是我的代码:

<?php
require '../functions/server_info.php';
$conn = mysqli_connect($sql_login["host"], $sql_login["username"], $sql_login["password"], $sql_db);
if (!$conn) {
    echo mysqli_connect_error();
}

&GT;

和server_info.php

$sql_login = array(
"host"=>"127.0.0.1", 
"port"=>"3306", 
"username"=>"root",
"password"=>"123456" 
);
$sql_db = "ipu1"; 

更新:我尝试通过将“host”=&gt;“127.0.0.1”更改为“host”=&gt;“localhost”来修复此错误。 但我不知道有什么不对?与“127.0.0.1”和“localhost”有什么不同。

0 个答案:

没有答案