鸿雁蒙语歌词发音拼音:xp下php用PDO连接sqlserver 2008

来源:百度文库 编辑:中财网 时间:2024/05/04 08:03:45

What a fucking day today!

As a junior php engineer,  I am shy by failing to connect mssql under PDO mode.

yes, I have allright config pdo-mssql, and it runs correctly, but once by pdo connecting, it failed.

Here is the solution following:

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=df4d9cc9-459c-4d75-a503-ae3fceb85860&displaylang=en

http://download.microsoft.com/download/0/E/6/0E67502A-22B4-4C47-92D3-0D223F117190/sqlncli.msi

 

Install sqlncli.msi first!!! Check your php version if it is thread safe or not, choose the right dll in SQLServerDriverForPHP20.exe when extracted, and , of course, remember config the php.ini file, add this line:

extension=php_pdo_sqlsrv_53_ts_vc6.dll

Then, run you test program:

try { $host=”111.111.111.111,2433″;$u=”sa”;$p=”123456″;$db=”haaway”; $conn = new PDO(“sqlsrv:server=$host;Database=$db”, $u, $p); $conn->setAttribute ( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION ); }catch ( PDOException $e){ echo $e->getMessage();}