I updated my server & moved both server itself & website on the same machine. After doing that, my website won't connect to DB anymore. I'm using Ubuntu 16.04 on aws
I'll include connection script, because a friend said my code might be too old for php 7. Other then that I'm looking for any suggestions which might result in fixing my problem.
include "../config.php";
$link = @mysql_connect($db_host, $db_user, $db_pass);
if (!$link)
{
$error = "Cannot access MYSQL, please contact admin!<br />";
$error .= mysql_errno() . ": " . mysql_error();
die($error);
}
$db = @mysql_select_db($db_name);
if (!$db)
{
$error = "Failed to select database.<br />";
$error .= mysql_errno() . ": " . mysql_error();
die($error);
}
$lang = @mysql_query("SET NAMES utf8");
@ is an error control operator. It means to php "if this call fails, let's log nothing and let's continue the trip" So remove those @ symbols before your mysql calls then see your logs.
Anyway those mysql calls won't be accepted by php7. You have now to use PDO or MySQLi
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.