PHP程序员站--PHP编程开发平台
 当前位置:主页 >> PHP基础 >> 基础文章 >> 

轻松搭建PHP5和SQL Server 2005开发环境

轻松搭建PHP5和SQL Server 2005开发环境

来源:blog.csdn.net  作者:  发布时间:2008-05-22
SQL Server 2005 php驱动是php5的一个扩展,它提供访问SQL Serve

SQL Server 2005 php驱动是php5的一个扩展,它提供访问SQL Server 2005和SQL Server 2000.该扩展数据访问接口可以应用在所有版本(包括体验版)的SQL Server 2005和SQL Server 2000.该SQL Server 2005 php驱动支持Windows验证,参数绑定(译预处理),大对象流,原数据访问和错误处理.

在你使用IIS:Internet Information Services和FastCGI组件,该驱动拥有良好的性能和稳定的Windows平台.
关于FastCGI组件可访问:FastCGI for IIS.

访问http://blogs.msdn.com/sqlphp和SQL Server Data Access Forum寻求支持和提供反馈

原文:

The SQL Server 2005 PHP Driver is a PHP 5 extension that provides data access to SQL Server 2005 and SQL Server 2000. The extension provides a procedural interface for accessing data in all versions (including Express) of SQL Server 2005 and SQL Server 2000. The SQL Server 2005 Driver for PHP API includes support for Windows Integrated Authentication, parameter binding, streaming of large objects, metadata access, and error handling.


The PHP Driver takes advantage of the improved performance and stability of PHP on the Windows platform when you are using Internet Information Services (IIS) and the FastCGI component. For more information about the FastCGI component, see FastCGI for IIS .


The functionality described and demonstrated in this document is a subset of the functionality planned for the final version of the SQL Server 2005 Driver for PHP and is subject to change. To provide feedback or find support, visit http://blogs.msdn.com/sqlphp or SQL Server Data Access Forum.

配置:

1.将php_sqlsrv.dll 或 php_sqlsrv_ts.dll 放到PHP的扩展目录中(PHP\EXT).
2.编辑php.ini文件,添加以下扩展:
extension=php_sqlsrv.dll

extension=php_sqlsrv_ts.dll
3.重启服务器.

示例:

以下为引用的内容:
<?php
$dbbase='testlab';
$uid='sa';

$pwd='infobus';
$connectionInfo=array("Database"=>$dbbase,"UID"=>$uid,"PWD"=>$pwd);

$serverName="JUJUMAOEXPRESS";
if(!($conn=sqlsrv_connect($serverName,$connectionInfo))){
    
echo "Connection could not be established. ";
    
die(print_r(sqlsrv_errors(),true));
}
$tSQL="SELECT login_mail FROM account";
if(!($stmt=sqlsrv_query($conn,$tSQL))){


    
echo "Error in statement. ";
    
die(print_r(sqlsrv_errors(),true));
}
if(!(sqlsrv_fetch($stmt))){
                    
echo "Error in retrieving row. ";
                    
die(print_r(sqlsrv_errors(),true));
}
$loginmail=sqlsrv_get_field($stmt,1);


echo $loginmail;

sqlsrv_close(
$conn);
?>

如果你在启动应用服务器时提示:
The application has failed to start because php5.dll was not found

缺少php5.dll
请访问:http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3175669&SiteID=1
或去PHP下载mirror包:
http://us3.php.net/get/php-5.2.5-nts-Win32.zip/from/a/mirror
解开包后把php5.dll放入你的PHP根目录即可

原文地址:http://blog.csdn.net/xiaofanku/archive/2008/05/19/2456934.aspx

Tags: 开发   环境   server   sql   php   for   php5   开发环境  
最新文章
推荐阅读
月点击排行榜
PHP程序员站 Copyright © 2007-2010,PHPERZ.COM All Rights Reserved 粤ICP备07503606号