武汉网福

  博客园  ::  :: 新随笔  :: 联系 ::  :: 管理

     新增一台win2003 server系统的服务器。以前其他的服务器上使用php5.0/5.1,数据库是SQL Server 2000;本次则打算安装SQL Server 2005,php5.3.2;据了解,php5.3版本使用微软的FastCGI模式,这种模式和传统的CGI模式相比采用了更加合理的解析进程启动模式,速度比CGI快2倍;在PHP5.3以上的版本已经对ISAPI模式不支持。

 

在已经安装iis6和ms sql server 2005后,整个安装过程是

1.安装FastCGI;

2.安装php5.3.2;

3.安装SQL Server Driver for PHP 1.1驱动;

 

一、在服务器上安装FastCGI

   在服务器上打开下面网址运行Microsoft Web 平台安装程序:
   http://www.microsoft.com/web/gallery/install.aspx?appsxml=&appid=PHP%3bPHP%3bPHP

  

Microsoft Web 平台安装程序

 

 

    如图:勾选选web服务器/自定义/应用程序开发/FastCGI1.0,下一步直至FastCGI安装完成;

   

    有关FASTCGI的官方说明文档:

    http://www.iis.net/articles/view.aspx/IIS7/Hosting-Web-Applications/PHP/Configuring-FastCGI-Extension-for-IIS6-0-and-IIS5-?Page=1

 

 

二、安装php5.3.2

      下载网址:http://windows.php.net/downloads/releases/

      截图:

php下载目录-本文为武汉网福互联原创

 

      我们下载这里目前所见的最新版本php-5.3.2-Win32-VC9-x86.msi 到服务器上,VC6用于apache,vc9用于win2003 server iis等;熟悉php的程序员可以下载zip版自行配置;

      运行php-5.3.2-Win32-VC9-x86.msi,安装中出现对话框,选择安装目录C:\PHP,选择IIS FASTCGI;完成安装。

 

三、配置IIS支持PHP

     1.FACTCGI安装后在c:\windows\system32\inetsrv下有五个文件,其中有用的是:fcgtext.dll,fcgitext.ini;打开FASTCGI配置文件fcgitext.ini,在最后[Types]修改为这样的样式:

    [Types]
    php=PHP
    [PHP]
    ExePath=c:\Php\php-cgi.exe

    2.打开IIS管理器,网站上点右键-属性-主目录-配置-添加fcgiext.dll为可执行文件,配置如下图

 

 

       经过上述步骤,已经完成了PHP5.3.2在iis6上的安装;如果下载的是zip版,则需对php.ini文件进行配置;

 

       之后,在iis里默认文档添加php。

 

四、安装SQL Server Driver for PHP 1.1驱动

     SQL Server Driver for PHP 1.1驱动支持SQL   Server 2005和 SQL Server 2008,目前最新的下载地址是:
     http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=ccdf728b-1ea0-48a8-a84a-5052214caad9

  系统环境:

  • Supported Operating Systems: Windows 2000 Service Pack 4; Windows 7; Windows Server 2003 Service Pack 2; Windows Server 2008; Windows Vista Service Pack 1; Windows XP Service Pack 3
  • PHP 5.2.4, or later. For more information about downloading and installing PHP, visit http://php.net/.
  • Microsoft SQL Server 2008 SQL Server Native Client. You can download SQL Server Native Client from a SQL Server 2008 Feature Pack.
  • Any edition of SQL Server 2005 or SQL Server 2008.
  • A Web server configured to run PHP.

     1.下载后文件名为SQLServerDriverForPHP11.EXE,解压如图:

 

    

  2.拷贝驱动php_sqlsrv_53_ts_vc9.dll到相应的位置PHP目录下ext文件夹内;

  3.配置的时候若需要配置一个PHP的扩展,此扩展需要将相关的dll文件全部复制到PHP的扩展目录里面,然后通过修改php.ini来实现PHP的扩展,在php.ini里面需要指明扩展路径,一般情况是在最末尾添加一行,所以修改php.ini实现扩展:

  在php.ini的一大堆;extension=**.dll格式里面添加一行,此部分位于以下注释下边一般:

; Windows Extensions
; Note that ODBC support is built in, so no dll is needed for it.
; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5)
; extension folders as well as the separate PECL DLL download (PHP 5).
; Be sure to appropriately set the extension_dir directive.

  添加的一行内容为:
     extension=php_sqlsrv_53_ts_vc9.dll

     保存php.ini后拷贝一份到windows目录下;
  选择php_sqlsrv_53_ts_vc9.dll的原因在于,php_sqlsrv_53_ts_vc9.dll是线程安全的驱动,如果服务器本身的环境是使用的php5ts.dll,对应的就用这个驱动;

    4.测试配置环境:
  整个过程操作好了过后,写一个test.php测试一下配置的相关环境,测试代码如下:
<?php
phpinfo();
?>
     若出现下图则说明已经成功启用FastCGI:

   

  

 

    若出现以下图片证明php5.3.2连接到ms sql server 2005数据库配置好了:

php5连接sql server2005配置

    安装后根据自己需要再对php.ini进行设置,重启IIS就可以了。

 

    注:如果安装sql server 2005时没有安装SQL Server Native Client 10.0 2007.100.2531.00,则php连接数据库是会有odbc数据源未设置之类的错误提示,那么就需要安装Microsoft SQL Server 2008 Native Client(2005和2008都适用)

    下载地址:

         X86 Package (sqlncli.msi) - 4504 KB
         X64 Package (sqlncli.msi) - 7919 KB
        IA64 Package (sqlncli.msi) - 11078 KB

     安装后在服务器上数据源ODBC里会出现SQL Server Native Client 10.0,如图

 

        至此,全部安装结束,可以开始编程了;

posted on 2010-03-31 21:47  网福  阅读(11766)  评论(0编辑  收藏  举报