美好的一天我想托管我在IIS中用php编写的网站我已经在我的服务器上安装了php并添加了dll文件但是在加载网站时我仍然收到HTTP 500错误。
我正在使用以下内容:
php 5.6.20 在我的php.ini文件中,我添加了
extension=php_sqlsrv_56_nts.dll
extension=php_pdo_sqlsrv_56_nts.dll
extension=pphp_pdo_sqlsrv_56_ts.dll
extension=php_sqlsrv_56_ts.dll
并在我的ext文件夹中添加了dll文件并重新启动了服务器
我想从服务器查询数据库,这是我与数据库的连接:
$servername = "TEST\TEST08";
$username = "Admin";
$password = "admin";
try {$conn = new PDO("sqlsrv:server=$servername;Database=My_Db",
$username,$password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo "Connected successfully";
}
catch(PDOException $e)
{
echo "Connection failed: " . $e->getMessage();
}
$getdrop = conn->prepare($myQ);
$getdrop->execute();
请协助
我有日志,我的日志文件中出现以下错误:
[10-May-2016 10:54:42 Europe/Minsk] PHP Notice: Undefined variable: conn in C:\test\index.php on line 43
[10-May-2016 10:54:42 Europe/Minsk] PHP Fatal error: Call to a member function prepare() on null in C:\test\index.php on line 43
[10-May-2016 10:54:43 Europe/Minsk] PHP Notice: Undefined variable: conn in C:\test\index.php on line 43
[10-May-2016 10:54:43 Europe/Minsk] PHP Fatal error: Call to a member function prepare() on null in C:\test\index.php on line 43