Home > Backend Development > PHP Tutorial > 依照步骤做的,php仍然不能连接到SQL Server2005 ?

依照步骤做的,php仍然不能连接到SQL Server2005 ?

WBOY
Release: 2016-06-13 11:04:33
Original
837 people have browsed it

按照步骤做的,php仍然不能连接到SQL Server2005 ??
1.下载正确版本的 ntwdblib.dll (2000.80.194.0)
2.配置php
a、打开php.in将extension=php_mssql.dll的注释符号去掉。
b、打开php.in将mssql.secure_connection = Off改为on。
c、将php_mssql.dll和ntwdblib.dll拷贝到php.in中extension_dir 指定的目录或者系统system32目录下。重启apache。
3.配置了sqlserver,重启

<br /><?php<br />if(mssql_connect('127.0.0.1,1433','sa','sa123')){ <br />echo   "Link SQL Server 2005 success!! "; <br />} <br />else   { <br />echo   "Fail "; <br />} <br />?><br />
Copy after login


结果Fail,还要怎么改啊??
------解决方案--------------------
mssql_connect('127.0.0.1:1433','sa','sa123')
一般可省略默认端口
mssql_connect('127.0.0.1','sa','sa123')
------解决方案--------------------
连接字符串写错了吧,1433前不是逗号,而是分号吧
------解决方案--------------------

echo   "Fail ";
改为
echo mssql_get_last_message();
------解决方案--------------------
用pdo比较好

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template