如何使用PHP连接到sql server [英] How to use PHP to connect to sql server
本文介绍了如何使用PHP连接到sql server的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用PHP连接到sql server数据库。
I want to use PHP to connect to sql server database.
我安装了xampp 1.7.0(php 5.2)和SQLSRV20。我在 php.ini
中添加了扩展程序,我收到此错误:
I installed xampp 1.7.0(php 5.2) and SQLSRV20. I've added the extensions in php.ini
and I get this error:
Warning: mssql_connect() [function.mssql-connect]: Unable to connect to
server: 10.85.80.229 in C:\xampp\htdocs\xampp\test.php on line 07
代码:
<?php
$myServer = "10.85.80.229";
$myUser = "root";
$myPass = "pass";
$myDB = "testdb";
$dbhandle = mssql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to SQL Server on $myServer");
?>
此错误消息是什么意思,如何连接到SQL Server?
What does this error message mean and how do I connect to SQL Server?
推荐答案
在php.ini中启用mssql
enable mssql in php.ini
; extension = php_mssql .dll
到
extension = php_mssql。 dll
这篇关于如何使用PHP连接到sql server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文