在Windows98/2K下安装全最新版Apache + PHP4 + MYSQL + phpMyadmin的方法 Version 2.3作者:Lee首先通报一下以上软件现在最新的版本号:
Apache 1.3.24      下载地址:http://www.onlinedown.net/apache.htm
PHP 4.2.1       下载地址:http://www.onlinedown.net/mysql.htm
MYSQL 3.23.41a    下载地址:http://www.onlinedown.net/php3.htm
phpMyadmin 2.2.6       下载地址:http://sourceforge.net/projects/phpmyadmin/*************
*一.基本安装*
*************
还用说吗?大家已经人手一份程序,把他们全装上就行了~!呵呵~~建议把他们都装在一个目录下,方便使用嘛。
注意:如果有最新版的程序,建议安装最新版的,这样子很有可能解决以前出现的问题!切记!:)这里假设Windows98/2K装在目录windir下。其它程序建议安装如下:
x:\SERVER
 |
 |-PROGRAM
    |
    |-PHP PHP程序目录
    |
    |-MYSQL MYSQL程序目录
    |
    |-MYADMIN phpMyadmin程序目录
    |
    |-APACHE 服务器程序目录*********
*二.设置*
*********
关键就是这里了!大家一步一步慢慢来~!*****
*(1)*将PHP目录下的PHP4TS.DLL复制到windir\system(Win2K是system32),还有将PHP.INI-DIST复制到windir,改名为PHP.INI
*****有一些无关紧要的设置,按自己的需要改吧~:
upload_max_filesize = 2097152; 上载文件的最大字节
include_path = \path1;\path2;\path3…… 在使用include函数时,只有指定目录下的文件才可以被包含******************************************************************************************
关于Session : 有些人说PHP在运行Session的会显示错误,这个问题多半是因为没有为Session建立一个叫
tmp的目录。方法:在x:\下面建立一个tmp的目录。
***********************************************************************************************
*(2)*修改Apache的配置文件
*****在安装的时候,Apache会提示你输入服务器名等,其实都不重要的。因为这些可以后来再改的,哈哈。最重要的,是修改CONF目录下的HTTPD.CONF文件:
Servername xxxxxx 改为 Servername localhost******************************************************************************************
注意:
(1)有人反映,如上设置后,别人的机器无法访问到自己的服务器,访问时会转向localhost。
这个是Apache的问题,有如下规律:如果访问的URL是 http://你的IP/目录
Apache收到请求后 会把URL解析到你所设的ServerName 也就是localhost
那客户方就会访问失败了。要改成 http://你的IP/目录/
才能正常访问.另外.这个问题在直接访问文件的时候不存在.(2)在DocumentRoot的下面不远,会有这样几行:
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "E:/server/program/Apache/htdocs">下面有一行:
    Options FollowSymLinks MultiViews Indexes请把Indexes删除,改成
    Options FollowSymLinks MultiViews这样,htdocs就不会被列出目录列表,要不是太没有安全感啦!大家一定要改!!
******************************************************************************************让Apache支持PHP其实也是很容易的呀,加上下面这么几句,就可以了!
ScriptAlias /php4/ "x:/PROGRAM/SERVER/PHP/"
AddType application/x-httpd-php4 .php
AddType application/x-httpd-php4 .php3
AddType application/x-httpd-php4 .php4
AddType application/x-httpd-php-source .phps
Action application/x-httpd-php4 "/php4/php.exe"这是以CGI方式运行PHP程序!
运行Apache后,显示
Apache/1.3.24 (Win32) running...如果想要以模块方式运行,请按这样子:
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php4
AddType application/x-httpd-php-source .phps
LoadModule php4_module "x:/server/program/php/sapi/php4apache.dll"运行Apache后,显示
Apache/1.3.24 (Win32) PHP/4.2.1 running...强烈推荐使用模块方式!!!Apache的默认启动文档为index.html、index.html还有DirectoryIndex,我们改成这样,支持更多的文档:
DirectoryIndex index.htm
DirectoryIndex index.html
DirectoryIndex index.php
DirectoryIndex index.php3
DirectoryIndex index.php4好,已经完成了……一半(*#$*^&(#*&%#*&@……)!不过还是先写用phpinfo()写一个测试文件看看吧!:)最新的PHP默认register_globals = Off,如果你的程序没做过修改的话,请记得设register_globals = On******************************************************************************************
Win2K的Apache是以服务方式运行,方法是在控制台中运行Apache -i安装服务,运行Apache -u卸载服务。
***********************************************************************************************
*(3)*设置MYSQL
*****在目录下有一个文件MY-EXAMPLE.CNF拷贝到C:\下面,改名为MY.CNF
可以加入用户名,密码,登陆主机,数据库和端口等信息!到BIN目录下,运行MYSQLD-MAX(感觉这个是最好的)!正常情况下DOS窗口一闪而过, 然后按Ctrl+Alt+Del看看有没有,有就是行啦~:)******************************************************************************************
Win2K的MYSQL也是以服务方式运行,方法是在控制台中运行mysqld-max-nt --install安装服务,运行
mysqld-max-nt --remove卸载服务。然后要在winmysqladmin中设置my.ini文件,这是Win2K与Win98差别
最大的地方!!切记!!
******************************************************************************************
*****
*(4)*设置phpMyadmin
*****最新版的phpMyadmin比以前的几版又强大了很多!推荐大家使用!首选修改:
$cfgPmaAbsoluteUri = '';
改成你的phpmyadmin所在的目录
$cfgPmaAbsoluteUri = 'http://localhost/myadmin/';
需要修改一下目录下的config.inc.php文件,把174行的:
$cfgDefaultLang = 'en';
改为
$cfgDefaultLang = 'zh';这样就成中文版的了!虽然意思有点别扭……呵呵~!还有这里:
$cfgServers[$i]['host']          = 'localhost'; // MySQL hostname
$cfgServers[$i]['port']          = '';          // MySQL port - leave blank for default port
$cfgServers[$i]['socket']        = '';          // Path to the socket - leave blank for default socket
$cfgServers[$i]['connect_type']  = 'tcp';       // How to connect to MySQL server ('tcp' or 'socket')
$cfgServers[$i]['controluser']   = '';          // MySQL control user settings
                                                // (this user must have read-only
$cfgServers[$i]['controlpass']   = '';          // access to the "mysql/user"
                                                // and "mysql/db" tables)
$cfgServers[$i]['auth_type']     = 'config';    // Authentication method (config, http or cookie based)?
$cfgServers[$i]['user']          = 'root';      // MySQL user
$cfgServers[$i]['password']      = '';          // MySQL password (only needed
                                                // with 'config' auth_type)
$cfgServers[$i]['only_db']       = '';          // If set to a db-name, only
                                                // this db is displayed
                                                // at left frame
                                                // It may also be an array
                                                // of db-names
$cfgServers[$i]['verbose']       = '';          // Verbose name for this host - leave blank to show the hostname
$cfgServers[$i]['bookdb']    = '';          // Book db - leave blank for no book support
$cfgServers[$i]['booktable'] = '';          // Book table - leave blank for no book support
$cfgServers[$i]['relation']      = '';          // table to describe the relation between links (see doc)
                                                //   - leave blank for no relation-links support一般按默认就可以了!这里是有关登录MYSQL服务器的设置,按上面改,缺啥补啥,这样就是使用MYSQL的缺省配置啦~呵呵:)到此,全部安装完成!去爽吧~:)

解决方案 »

  1.   

    摘录php-4.1.2-Win32.zip中的install.txt的一部分:
    Installing PHP on Windows with Apache 1.3.xThere are two ways to set up PHP to work with Apache 1.3.x
    on Windows. One is to use the CGI binary (php.exe),
    the other is to use the Apache module dll. In either case
    you need to stop the Apache server, and edit your
    srm.conf or httpd.conf to configure Apache to work with PHP.Although there can be a few variations of configuring PHP
    under Apache, these are simple enough to be used by the
    newcomer. Please consult the Apache Docs for further
    configuration directives.Now that version 4.1 introduces a safer sapi module, we recommend
    that you configure PHP as a module in Apache.To do this, you should move php4ts.dll to the windows/system (for Windows 9x/Me)
    or winnt/system32 (for Windows NT/2000/XP) directory, overwriting any
    older file. Then you should add the following three lines to your Apache
    conf file: (swap c:/php/ for your PHP install path)
    ########################
    ########################
    看这里!!!!!!!!!!!!!!!LoadModule php4_module c:/php/sapi/php4apache.dll
    AddModule mod_php4.c
    AddType application/x-httpd-php .php########################
    ########################
    If you wish to install PHP as a CGI binary, (the sapi is much better)
    you need to enable the apache security fix in your php.ini by 
    setting cgi.force_redirect = 1. Then, insert these lines to your conf file:ScriptAlias /php/ "c:/php/"
    AddType application/x-httpd-php .php
    Action application/x-httpd-php "/php/php.exe"As a further precaution, we recommend you change the "/php/"
    ScriptAlias to something more random, to prevent any attempts to 
    call your binary (like the Code Red scripts) for returning a response
    other than 404.Remember when you have finished to restart the server, for example,
    NET STOP APACHE
    followed by
    NET START APACHETo use the source code highlighting feature, add the following
    line to your apache httpd.conf file:AddType application/x-httpd-php-source .phpsNote, this will only work when you install php as a sapi module.
    If you wish to use this feature with the cgi binary, create a new
    file, and use the show_source("path/to/original_file.php"); function.On Win-Apache all backslashes in a path statement such
    as: "c:\directory\file.ext", must be converted to
    forward slashes.
      

  2.   

    我的安装和你有点不一样,我的是windows98+apache_1.3.26-win32-x86-no_src.exe+php-4.1.2-Win32.zip。PHP同样是以模块方式安装。操作系统虽然不一样,不过安过程却是一样了:
    1.安装Apache_1.3.26在c:\Apache目录下。在提示输入什么Network domain,server Name时填localhost好了。至于Adiministrator Email Address随便。
    2.解压php-4.1.2-Win32.zip到c:\Apache\php目录下。
    3.将PHP目录中的php.ini-dist改名php.ini并拷贝到c:\winnt目录下(假设win2000安装到这里)。
    4.修改php.ini:
    设置 doc_root = c:\apache\htdocs
    设置 include_path = ".;C:\Apache\php\pear"
    5.拷贝PHP目录下的php4ts.dll文件到c:\winnt\system32目录下。
    6.修改c:\apache\conf\httpd.conf文件,增加以下几行:
    LoadModule php4_module c:/apache/php/sapi/php4apache.dll
    AddModule mod_php4.c
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php .php3
    AddType application/x-httpd-php .phtml
    同时最好修改
    <IfModule mod_dir.c>
        DirectoryIndex index.html
    </IfModule>

    <IfModule mod_dir.c>
        DirectoryIndex index.html index.htm index.php
    </IfModule>
    7.重启Apache。如果安装时选了它作为一个服务时可以用下面的语句:
    NET STOP APACHE(回车)
    NET START APACHE(回车)
    否则直接对apache窗口“Ctrl+C”,然后再在启动菜单中启动它。
    8.在浏览器窗口中输入:http://localhost就可以显示你的操作系统所用语言版本的首页。不过对于中文而言,apache1.3.26只提供了繁体中文版,即index.html.zh,所以此时会出现一个什么对象不存在的报错页面。不管它,你自己写一个index.html放到c:\apache\htdocs目录下,再刷新浏览器,看到了什么。
    9.大功告成!
      

  3.   

    我感觉大家要求的东西好奇怪,为什么win2000的机器要配apache呢?
    有iis不用,要体验linux,自己装一个不就得了,而且apache,php在linux和win2000下编译成的二进制代码并不同,配置文件也不尽相同,
    在linux下面有php4_mod.c之类的,而在windows下面只有*.dll搞不懂,大家要多多看英文,下的包里面都有INSTALL文件,具体的配置一清二楚的!!
      

  4.   

    因为在默认情况下,Apache要比IIS安全.
    教新手用IIS,如果教不好,没打好补丁,管理不好,结果给Nimda瞄上了,偶认为是害了他.
      

  5.   

    哈,楼上说的好,的确如此,
    不过最近听说apache也有漏洞了,
    具体消息在《永远的unix》网站上有。:)
      

  6.   

    哈,楼上说的好,的确如此,
    不过最近听说apache也有漏洞了,
    具体消息在《永远的unix》网站上有。:)
      

  7.   

    哈,楼上说的好,的确如此,
    不过最近听说apache也有漏洞了,
    具体消息在《永远的unix》网站上有。:)