CentOS7。我已经安装了
yum install freetds-bin
和
yum install php5-mssql
phpinfo中的PDO驱动程序:dblib,mysql,sqlite
带连接的文件:
try {
$hostname = "xxx.xxx.xxx.xx";
$port = 1443;
$dbname = "MyName";
$username = "test";
$pw = "123456";
$dbh = new PDO ("dblib:host=$hostname:$port;dbname=$dbname","$username","$pw");
} catch (PDOException $e) {
echo "Failed to get DB handle: " . $e->getMessage() . "\n";
exit;
}
此页面运行时间很长,最后显示错误500.
此文件中的连接错误?或者是在MSSQL端错误地打开了SQL Server的远程访问?如何理解问题的哪一方?