PHP5.0 + MYSQL5.0 + WIN2003服务器的配置方法

   配置最新的PHP5.0 + MYSQL5.0 + WIN2003服务器
   
相关软件均可以在 www.SKYCN.NET 下载.
    MYSQL 5.0 FOR WINDOWS
    PHP 5.0 FOR WINDOWS
    PHPMYADMIN
    WINDOWS SERVER 2003 

1.首先安装 MYSQL.

    因为 5.0 4.0 体积大很多.所以安装时间略长.
   
推荐安装在独立的 NTFS 分区上.比如我服务器的D.只放服务器软件.
   
路径为: D:/MYSQL/
   
然后进入 D:/MYSQL/BIN/ 鼠标双点 winmysqladmin.exe
   
首次运行会提示输入超级用户和密码.就输入 root 密码 root
   
注意:如果是对外服务器请设置比较复杂的密码.
   MYSQL
就安装完毕了.

2. 安装 PHP 5.0

其实没什么安装不安装的.解压缩文件.推荐放到路径为: D:/PHP/
   
首先复制 PHP 目录下的 Php.ini-dist C:/Windows/ 并将文件名修改成为 Php.ini
    COPY D:/PHP/Php.ini-dist C:/Windows
    Ren Php.ini-dist Php.ini
 
如果是 WINDOWS 2000 就是: C:/WINNT/
 
如果是 WIN9X / 2003 就是: C:/Windows/
 
然后复制 PHP 目录下 DLLS 目录里的所有文件到 SYSTEM32 目录.
    COPY D:/PHP/dlls/*.* C:/Windows/System32/
   
如果是 WINDOWS 2000 就是: C:/WINNT/System32/
   
如果是 WIN9X / 2003 就是: C:/Windows/System32/
 
复制PHP目录下 php4ts.dll 文件到 System32 目录里.
  COPY D:/PHP/php4ts.dll C:/Windows/System32/
 

下面修改 C:/Windows/Php.ini 文件.
   
请注意.5.0的版本修改与4.0并不完全相同.需要注意的如下.
   
查找 extension_dir 字串.修改为你 PHP 目录里 extensions 的路径.
    ; Directory in which the loadable extensions (modules) reside.
    extension_dir = D:/PHP/extensions

   
相关官方技术资料:
    Edit your php.ini file:
    You will need to change the extension_dir setting to
    point to your php-install-dir, or where you have placed
    your php_*.dll files. ex: c:/php

    If you are using OmniHTTPd, do not follow the next step.
    Set the doc_root to point to your webservers
    document_root. ex: c:/apache/htdocs or c:/webroot

    Choose which extensions you would like to load when PHP
    starts, noting that several extensions are already built
    into the Windows release, see the section about
    Windows extensions for details of the built-in extensions.
    You can uncomment the: extension=php_*.dll lines
    in php.ini to load these extensions.

    Note that on a new installation it is advisable to first get
    PHP working and tested without any extensions before enabling
    them in php.ini.

    On PWS and IIS, you can set the browscap.ini
    to point to: c:/windows/system/inetsrv/browscap.ini on
    Windows 9x/Me and c:/winnt/system32/inetsrv/browscap.ini
    on NT/2000/XP Server.

    More information on the capabilities of browscap can be found here:

    www.php.net/manual/en/function.get-browser.php

    Note that the mibs directory supplied with the Windows distribution
    contains support files for SNMP. This directory should be moved to
    DRIVE:/usr/mibs (DRIVE being the drive where PHP is installed.)

   
然后与 PHP 4.0 不同的是.需要修改 Php.ini 文件里的如下内容
   
查找 cgi.force_redirect 字串.默认值为1.将其修改为0.并取消前面的;.
   
:

    ; cgi.force_redirect is necessary to provide security running PHP as a CGI under
    ; most web servers. Left undefined, PHP turns this on by default. You can
    ; turn it off here AT YOUR OWN RISK
    ; **You CAN safely turn this off for IIS, in fact, you MUST.**
    cgi.force_redirect = 0

   
切记如上修改的地方.否则PHP 5.0是无法运行的.会有如下提示.
    Security Alert! The PHP CGI cannot be accessed directly.

   
相关官方技术资料:
    !NOTE!: Since 4.1.2 , the php.ini setting cgi.force_redirect defaults to 1
    which effectively prevents the cgi from working within IIS. You need to set
    up at least a minimal php.ini file with the following directive:

    cgi.force_redirect = 0

    If it doesn t work immidiately, make sure you have the php.ini file in the
    right place (%SYSTEMROOT%/php.ini).

   
接下来修改 Php.ini 文件关于 MYSQL 5.0 的设置.
   
查找 [MySQL] 字段内的内容.修改如下.
    mysql.default_port = 3306
    //
这里是MYSQL的端口.
    mysql.default_host = localhost
    //
这里是本地主机.
    mysql.default_user = root
    //
这里是用户
    mysql.default_password = root
    //
这里是密码
   
修改到这里就可以让 Php MYSQL 关联了.
   
最后启动 PHP MYSQL 模块支持.
   
查找 extension=php_mysql.dll 字串.删除掉前面的 ;
    extension=php_mysql.dll
   
请注意.如果不启动 PHP MYSQL 模块支持.将无法使 PHPMYADMIN 正常工作.将提示:
    cannot load MySQL extension, please check PHP Configuration
   
无法装入 MySQL 扩展,请检查 PHP 的配置。 

  IIS6中配置PHP/Perl支持

操作系统:WIndows Server 2003 Datacenter / Enterprise / Standard / Webserver

组件配置:IIS6.0 (确认在控制面板中安装了Add/Remove windows components -> Application -> IIS)
操作权限:本地管理员 (Local Administrator)
3方支持:安装 ActiveState ActivePerl C:/Perl (ActiveState ActivePerl 可以在 http://www.activestate.com 下载)

首先,检查网络环境

操作系统:WIndows Server 2003 Datacenter / Enterprise / Standard / Webserver
组件配置:IIS6.0 (确认在控制面板中安装了Add/Remove windows components -> Application -> IIS)
操作权限:本地管理员 (Local Administrator)
3方支持:安装 ActiveState ActivePerl C:/Perl (ActiveState ActivePerl 可以在 http://www.activestate.com 下载)
配置IIS

通过以下任何一种方式运行IIS管理器:
1. Start -> Administrative Tools -> IIS Manager
2. Start -> Run -> %SystemRoot%/system32/inetsrv/iis.msc (%SystemRoot%
为操作系统所在目录,如: C:/Windows)
点击Service Extensions,在主窗口左侧的 Add a new Web service extension... 上点击添加新的服务扩展,如下图:

 

3
New Web Service Extension 对话框中, 在 Extension Name 中输入自定义的标识, 如: CGI Ext, Required Files 中单击Add, 输入 C:/Perl/bin/perl.exe "%s" %s ,并确定下面的"Set status to allowed" 选项被选中:
 

4 在默认的IIS发布目录 c:/inetpub (如果操作系统安装在其他分区, 此目录可能不同,如: d:/inetpub) 中建立 cgi-bin 子目录;

5
。在Default Web Site 中建立一个虚拟目录,目录指向 C:/Inetpub/cgi-bin 并在目录权限中如下图设置:


6
打开cgi-bin虚拟目录的properties,在 Application Configuration 确认 .pl 扩展已经被正确的映射:

脚本配置:
建议修改所有的 .cgi 脚本为 .pl
在脚本文件中将:
#!/usr/bin/perl
改为 #!c:/perl/bin/perl.exe
任何/home/user 改为 c:/home/user c://home//user
完成以上配置后,你的 perl 脚本将可以在 IIS 6 上运行。

IIS6 中由于隔离了服务器端的扩展和应用程序及脚本级的映射, Windows Server 2003 中安装 php ISAPI 方式和 IIS5 不同。以下介绍IIS6 中手工设置php - ISAPI的方法.

首先, 检查系统环境配置:

操作系统: WIndows Server 2003 Datacenter / Enterprise / Standard / Webserver
组件配置: IIS6.0 (确认在控制面板中安装了Add/Remove windows components -> Application -> IIS)
操作权限: 本地管理员 (Local Administrator)
3方支持: 解压缩 PHP distribution zip 安装包至 C:/PHP (PHP 4.x 可以在 http://www.php.com 下载)
配置IIS:

复制 c:/php 中的 php.ini-recommended Windows 目录下,如: c:/windows, 并改名为 php.ini
复制 c:/php 中的 php4ts.dll Windows 的系统目录下,如: c:/windows/system32
通过以下任何一种方式运行IIS管理器:
1. Start -> Administrative Tools -> IIS Manager
2. Start -> Run -> %SystemRoot%/system32/inetsrv/iis.msc (%SystemRoot%
为操作系统所在目录,如: C:/Windows)
点击Service Extensions, 在主窗口左侧的 Add a new Web service extension... 上点击添加新的服务扩展, 如下图:

5New Web Service Extension 对话框中,在 Extension Name 中输入自定义的标识,如: PHP Ext,在Required Files 中单击Add,输入 c: / php / sapi / php4isapi.dll ,并确定下面的"Set status to allowed" 选项被选中;


6。在默认的IIS发布目录 c:/inetpub (如果操作系统安装在其他分区,此目录可能不同,如: d:/inetpub) 中建立 phpscript 子目录;

7
。在Default Web Site 中打开 phpscript 目录的属性对话框,在 Application setting 中点击create,生成 phpscript 应用程序(注意: 运行权限为 scripts only)

 

8。点击Configuration,进入应用程序设置对话框,添加一个extension mapping


9.phpApplication extension被添加进了列表:


完成以上配置后,你的 php 脚本将以 isapi 模式在 IIS 6 上运行 (phpscript中运行)

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值