Recently applied for the student machine, I tried to connect the database on Linux:
try { $conn = new PDO("mysql:host=$server;dbname=$db",$user,$pass); echo "connection success!";}catch(PDOException $e) { echo $e->getMessage();}
But the Web page is not connected, return status code: 500
The local host test connection is successful, the confirmation code is not error (account, password, database are correct),
Under the Linux host, test:
PHP test.php//Return connection success!
It's strange why the PHP command can run and the Web page just can't get out?
Is it because there is no PDO extension? If so, how do I install it?
Reply content:
Recently applied for the student machine, I tried to connect the database on Linux:
try { $conn = new PDO("mysql:host=$server;dbname=$db",$user,$pass); echo "connection success!";}catch(PDOException $e) { echo $e->getMessage();}
But the Web page is not connected, return status code: 500
The local host test connection is successful, the confirmation code is not error (account, password, database are correct),
Under the Linux host, test:
PHP test.php//Return connection success!
It's strange why the PHP command can run and the Web page just can't get out?
Is it because there is no PDO extension? If so, how do I install it?
Most of the MySQL user rights are set incorrectly, locally accessible, and the transport denies access
$serverIf "localhost" so, you might as well "127.0.0.1" try it. The two are not the same.