首页 | PHP资讯 | 技术专栏 | 资源共享 | PHP培训 | PHP职场 | 图书 | PHP ON WIN | PHP圈子
返回列表 回复 发帖

Windows 2K,XP,2003下搭建Apache2+MySql4+PHP5+phpMyAdmin+ZendOptimizer

Windows 2K,XP,2003下搭建Apache2+MySql4+PHP5+phpMyAdmin+ZendOptimizer

apache2 + php5 + mysql4 +ZendOptimizer的安装配置

安装文件:(你也可以下载当前最新的版本Apache 2.0.55,PHP 5.1.2,MySql 4.0.18,ZendOptimizer2.6.2)
    Apache_2.0.49
    php-5.0.0RC2-Win32
    mysql-4.0.18-win
    phpMyAdmin-2.6.0-alpha1
    ZendOptimizer2.6.2
下载地址是:
http://www.apache.org
http://www.php.net
http://www.mysql.com
http://www.phpmyadmin.com
http://www.zend.com
-----------------------------------------------------------------------------------------
一、安装Apache2
  
双击运行apache_2.0.49-win32-x86-no_ssl.exe,安装apache2,这个比较简单只需注意一点:Network Domaidn(e.g.somenet.com)填上127.0.0.1;
Server Name(e.e.www.somenet.com):填上127.0.0.1,
Administrator's Email Address(e.g.webmaster@somenet.com):可随便填一个邮箱~
安装完毕。

配置方法:
安装完毕后,用我们提供的httpd.conf文件与你服务器的httpd.conf(在apache2\conf\文件夹内)相对应参考修改~里面我们说得比较详细~!
我们采用:
######################################################
#这里面这是注释, 前面加了“#”,就是表注释的,
如果那句前没有“#”则,就会被程序运行~
有绝对地址的地方,你可以根据实际情况,做一定的修改~即可。
#######################################################

------------------------------------------------------------
二、安装mysql4(原本为mysql5,但我们发现mysql4.0.18以后的数据库版本用phpMyAdmin 添加密码后,phpMyAdmin 就连不上了,所以改为mysql4.0.18)

   运行setup.exe 安装路径随便你~ 安装完毕。

配置方法:

在mysql安装目录下找到(my-huge、my-large...my-small)文件,随便找一个拷到c:\ 盘下 重命名为my,(全名为my.cnf,在windows下显示不出后缀名)。用记事本打开(此处,你可先打开记事本,再把my.cnf文件拖进记事本里,这也是一种打开文件的方法^_^),找到:
        basedir = d:/mysql/
        datadir = d:/mysql/data/

看你的mysql安装路径是不是正确~,不正确改正过来,如果你面有“#”把它去掉,保存!即可。
****************
可选操作:把mysql当作服务,开机运行~
(以mysql 安装在c:\mysql为例):打开cmd
         
C:\> cd mysql\bin
C:\mysql\bin> mysqld-nt --install               //此处是把mysql作为服务,以后开机即可自动启动!
-------------------------------------
上面的mysqld-nt也可以改为用下面这几个中的任意一个,后面加 -install,回车即可~
              mysqld-opt
              mysqld-max
              mysqld-max-nt
-------------------------------------
如果要去掉服务可键入:
C:\mysql\bin> mysqld-nt --remove   

你可以到 控制面板-管理工具-服务 中看看mysql服务是否启动,和它的启动类型是不是: 自动
当然,如果你不想把它作为服务启动,你只有在用到mysql时到mysql\bin下运行winmysqladmin.exe了.

-----------------------------------------------------------------------------------------
三、安装php5

安装设置:
    安装php5很简单,只需把压缩包里的php-5.0.0RC2-Win32 文件夹改名为 php 文件夹,拷到你要放的地方。把该文件夹内的php.ini-dist改名为php.ini

根据我们提供的php.ini作参考来修改你的php.ini文件.
我们在php.ini中的注释符号为:
;------------------------------------------------------------------------------;
;其中";"是注释符号,
句前没有";" 的将被执行!
;------------------------------------------------------------------------------;

四、phpMyAdmin的安装
phpMYAdmin主要是对mysql数据库进行操作的,你只要把压缩包内的phpMyAdmin-2.6.0-alpha1文件夹拷到X:\Apache2\htdocs文件夹内~,你也可以把phpMyAdmin-2.6.0-alpha1改名为Admin或其它名称的文件夹。
  如果你的Mysql设有密码~,可找到phpMyadmin文件夹内的config.inc.php文件,打开该文件~分别找到:


$cfg['Servers'][$i]['user']          = 'root';  //此处为数据库用户名
$cfg['Servers'][$i]['password']      = '';     //此处为数据库密码

(找到第一处,修改即可~!)

都要更改成你设置的用户名和密码,保存即可~!


___________________________________________________________________________________

注意!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

将PHP目录下的 libmySQL.dll 和修改好的 php.ini 拷贝到系统目录(c:\windows 或c:\winnt)

重新启动Apache,呵呵~Apache2+php5+mysql4就配置完成了~

####################################################################
___________________________________________________________________________________
五.ZendOptimizer2.6.2的安装
你可以直接点击的ZendOptimizer-2.6.2-Windows-i386.exe安装,中间需要找你的php.ini文件的路径,你更改成你的安装目录比如现在我们的C:\php
这样就完成了windows下apache2 + php5 + mysql4 +ZendOptimizer的安装配置!!!

[ 本帖最后由 forest 于 2006-6-25 23:59 编辑 ]
附件: 您需要登录才可以下载或查看附件。没有帐号?注册
成功就是成为最好的你自己!
怎么没有人顶啊,难道没有人在windows下安装php5+Apache2+Mysql4+ZendOptimizer2.6么?
成功就是成为最好的你自己!
我来支持楼主了~
TC
谢谢楼上的鼓励,呵呵~~~!!!
另外在windows下有时候容易出现连接不上mysql的现象:
请使用如下方法更改你的mysql的密码:
如果是ROOT密码忘记了可以这样修改
WINDOWS系统的:
1.用系统管理员登陆系统。
2.停止MySQL的服务。
3.进入命令窗口(即:在“开始”--“运行”键入cmd),然后进入MySQL的安装目录,
比如我的安装目录是c:\mysql,再进入C:\mysql\bin
4.跳过权限检查启动MySQL,
c:\mysql\bin>mysqld-nt --skip-grant-tables
5.重新打开一个窗口,进入c:mysqlbin目录,设置root的新密码
c:\mysql\bin>mysqladmin -u root flush-privileges password "newpassword"
c:\mysql\bin>mysqladmin -u root -p shutdown
将newpassword替换为你要用的root的密码,第二个命令会提示你输入新密码,重复第一个命令输入的密码。
6.停止MySQL Server,用正常模式启动Mysql
7.你可以用新的密码链接到Mysql了。

以上方法我已实验过,切实可行!

Unix&Linux:

1.用root或者运行mysqld的用户登录系统;
2.利用kill命令结束掉mysqld的进程;
3.使用--skip-grant-tables参数启动MySQL Server
shell>mysqld_safe --skip-grant-tables &
4.为root@localhost设置新密码
shell>mysqladmin -u root flush-privileges password "newpassword"
5.重启MySQL Server

[ 本帖最后由 forest 于 2006-8-28 12:20 编辑 ]
应该是弄个  Windows Xp/2003  Apache2.2 PHP5.1 MYSQL5.1
另外楼主的帖子很糟糕.不知道为什么斑竹会给你精华.
我是大菜鸟,怎么一点也看不懂啊???

我现在把httpd.conf的文件内容发上来

#说明
##############################################################

#注意,只能对我们作有注释的地方进行参考来修改你Apache服务器的httpd.conf文件!!一定要仔细,耐心!
#本文件的apache2的安装路径是:c:\apache2   php5安在c:\php  
#
#要修改,只需把我们注释中的绝对路径改正确就行了!
#要使更改能生效,需重启Apache服务!
#在此文件中 "#"在前面是注释符号,跟在它后面的该行都不会被电脑编译!
###############################################
# Based upon the NCSA server configuration files originally by Rob McCool.
#
# This is the main Apache server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs-2.0/> for detailed information about
# the directives.
#
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. You have been warned.  
#
# The configuration directives are grouped into three basic sections:
#  1. Directives that control the operation of the Apache server process as a
#     whole (the 'global environment').
#  2. Directives that define the parameters of the 'main' or 'default' server,
#     which responds to requests that aren't handled by a virtual host.
#     These directives also provide default values for the settings
#     of all virtual hosts.
#  3. Settings for virtual hosts, which allow Web requests to be sent to
#     different IP addresses or hostnames and have them handled by the
#     same Apache server process.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path.  If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/foo.log"
# with ServerRoot set to "C:/Apache2" will be interpreted by the
# server as "C:/Apache2/logs/foo.log".
#
# NOTE: Where filenames are specified, you must use forward slashes
# instead of backslashes (e.g., "c:/apache" instead of "c:\apache").
# If a drive letter is omitted, the drive on which Apache.exe is located
# will be used by default.  It is recommended that you always supply
# an explicit drive letter in absolute paths, however, to avoid
# confusion.
# Section 1: Global Environment
#
# The directives in this section affect the overall operation of Apache,
# such as the number of concurrent requests it can handle or where it
# can find its configuration files.

# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# NOTE!  If you intend to place this on an NFS (or otherwise network)
# mounted filesystem then please read the LockFile documentation (available
# at <URL:http://httpd.apache.org/docs-2.0/mod/mpm_common.html#lockfile>);
# you will save yourself a lot of trouble.
#
# Do NOT add a slash at the end of the directory path.
#
ServerRoot "C:/Apache2"

#
# ScoreBoardFile: File used to store internal server process information.
# If unspecified (the default), the scoreboard will be stored in an
# anonymous shared memory segment, and will be unavailable to third-party
# applications.
# If specified, ensure that no two invocations of Apache share the same
# scoreboard file. The scoreboard file MUST BE STORED ON A LOCAL DISK.
#
#ScoreBoardFile logs/apache_runtime_status

#
# PidFile: The file in which the server should record its process
# identification number when it starts.
#
PidFile logs/httpd.pid

# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300

# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 15

## Server-Pool Size Regulation (MPM specific)
##
# WinNT MPM
# ThreadsPerChild: constant number of worker threads in the server process
# MaxRequestsPerChild: maximum  number of requests a server process serves
<IfModule mpm_winnt.c>
ThreadsPerChild 250
MaxRequestsPerChild  0
</IfModule>

# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
#Listen 12.34.56.78:80
Listen 80

#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule access_module modules/mod_access.so
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_module modules/mod_auth.so
#LoadModule auth_anon_module modules/mod_auth_anon.so
#LoadModule auth_dbm_module modules/mod_auth_dbm.so
#LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule autoindex_module modules/mod_autoindex.so
#LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule cgi_module modules/mod_cgi.so
#LoadModule dav_module modules/mod_dav.so
#LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
#LoadModule expires_module modules/mod_expires.so
#LoadModule file_cache_module modules/mod_file_cache.so
#LoadModule headers_module modules/mod_headers.so

[ 本帖最后由 forest 于 2006-3-28 23:46 编辑 ]

httpd.conf

LoadModule imap_module modules/mod_imap.so
LoadModule include_module modules/mod_include.so
#LoadModule info_module modules/mod_info.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
#LoadModule mime_magic_module modules/mod_mime_magic.so
#LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule negotiation_module modules/mod_negotiation.so
#LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
#LoadModule speling_module modules/mod_speling.so
#LoadModule status_module modules/mod_status.so
#LoadModule unique_id_module modules/mod_unique_id.so
LoadModule userdir_module modules/mod_userdir.so
#LoadModule usertrack_module modules/mod_usertrack.so
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
#LoadModule ssl_module modules/mod_ssl.so

#
# ExtendedStatus controls whether Apache will generate "full" status
# information (ExtendedStatus On) or just basic information (ExtendedStatus
# Off) when the "server-status" handler is called. The default is Off.
#
#ExtendedStatus On

### Section 2: 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition.  These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#

#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed.  This address appears on some server-generated pages, such
# as error documents.  e.g. admin@your-domain.com
#
ServerAdmin science_admin@163.com

#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If this is not set to valid DNS name for your host, server-generated
# redirections will not work.  See also the UseCanonicalName directive.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
# You will have to access it by its address anyway, and this will make
# redirections work in a sensible way.
#

##############################################################################

ServerName 127.0.0.1:80
#这个servername 就是你本机服务器地址:127.0.0.1 端口是80
###############################################################################
#
# UseCanonicalName: Determines how Apache constructs self-referencing
# URLs and the SERVER_NAME and SERVER_PORT variables.
# When set "Off", Apache will use the Hostname and Port supplied
# by the client.  When set "On", Apache will use the value of the
# ServerName directive.
#
UseCanonicalName Off

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
###############################################################################

DocumentRoot "C:/Apache2/htdocs"
##              ↑这个路径是放php的文件夹,服务器根目录,http://127.0.0.1中的文件就在该文件夹里面
##            你可以更改到你喜欢的文件夹~(下面还有一个)
###############################################################################
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.  
#
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>

#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

#
# This should be changed to whatever you set DocumentRoot to.
#

############################################################################

<Directory "C:/Apache2/htdocs">
##              ↑这里,如果要改的话,两个路径都要改啊!!
############################################################################
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important.  Please see
# http://httpd.apache.org/docs-2.0/mod/core.html#options
# for more information.
#
    Options Indexes FollowSymLinks

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
    AllowOverride None

#
# Controls who can get stuff from this server.
#
    Order allow,deny
    Allow from all

</Directory>

httpd.conf

#
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.  Be especially careful to use
# proper, forward slashes here.  On Windows NT, "Personal/My Website"
# is a more appropriate choice.
#
UserDir "My Documents/My Website"

#
# Control access to UserDir directories.  The following is an example
# for a site where these directories are restricted to read-only.
#
# You must correct the path for the root to match your system's configured
# user directory location, e.g. "C:/WinNT/profiles/*/My Documents/My Website"
# or whichever, as appropriate.
#
#<Directory "C:/Documents and Settings/*/My Documents/My Website">
#    AllowOverride FileInfo AuthConfig Limit
#    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
#    <Limit GET POST OPTIONS PROPFIND>
#        Order allow,deny
#        Allow from all
#    </Limit>
#    <LimitExcept GET POST OPTIONS PROPFIND>
#        Order deny,allow
#        Deny from all
#    </LimitExcept>
#</Directory>

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
# The index.html.var file (a type-map) is used to deliver content-
# negotiated documents.  The MultiViews Option can be used for the
# same purpose, but it is much slower.
#
#########################################################################

#  DirectoryIndex index.html index.html.var

#  上面这个是系统默认,可添加 index.php index.php3 即:

DirectoryIndex index.php index.html index.php3 index.htm

#  让它支持php、php3,当然也可添加index.php4 index.php5 让它支持php4、php5
########################################################################

#
# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives.  See also the AllowOverride
# directive.
#
AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
</Files>

#
# TypesConfig describes where the mime.types file (or equivalent) is
# to be found.
#
TypesConfig conf/mime.types

#
# DefaultType is the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value.  If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain

#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type.  The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
<IfModule mod_mime_magic.c>
    MIMEMagicFile conf/magic
</IfModule>

#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
# The default is off because it'd be overall better for the net if people
# had to knowingly turn this feature on, since enabling it means that
# each client request will result in AT LEAST one lookup request to the
# nameserver.
#
HostnameLookups Off

#
# EnableMMAP: Control whether memory-mapping is used to deliver
# files (assuming that the underlying OS supports it).
# The default is on; turn this off if you serve from NFS-mounted
# filesystems.  On some systems, turning it off (regardless of
# filesystem) can improve performance; for details, please see
# http://httpd.apache.org/docs-2.0/mod/core.html#enablemmap
#
#EnableMMAP off

#
# EnableSendfile: Control whether the sendfile kernel support is
# used  to deliver files (assuming that the OS supports it).
# The default is on; turn this off if you serve from NFS-mounted
# filesystems.  Please see
# http://httpd.apache.org/docs-2.0/mod/core.html#enablesendfile
#
#EnableSendfile off

#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog logs/error.log

#
# LogLevel: Control the number of messages logged to the error.log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn

#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

# You need to enable mod_logio.c to use %I and %O
#LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here.  Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
CustomLog logs/access.log common

#
# If you would like to have agent and referer logfiles, uncomment the
# following directives.
#
#CustomLog logs/referer.log referer
#CustomLog logs/agent.log agent

#
# If you prefer a single logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
#CustomLog logs/access.log combined

#
# ServerTokens
# This directive configures what you return as the Server HTTP response
# Header. The default is 'Full' which sends information about the OS-Type
# and compiled in modules.
# Set to one of:  Full | OS | Minor | Minimal | Major | Prod
# where Full conveys the most information, and Prod the least.
#
ServerTokens Full

#
# Optionally add a line containing the server version and virtual host
# name to server-generated pages (internal error documents, FTP directory
# listings, mod_status and mod_info output etc., but not CGI generated
# documents or custom error documents).
# Set to "EMail" to also include a mailto: link to the ServerAdmin.
# Set to one of:  On | Off | EMail
#
ServerSignature On

#
# Aliases: Add here as many aliases as you need (with no limit). The format is
# Alias fakename realname
#
# Note that if you include a trailing / on fakename then the server will
# require it to be present in the URL.  So "/icons" isn't aliased in this
# example, only "/icons/".  If the fakename is slash-terminated, then the
# realname must also be slash terminated, and if the fakename omits the
# trailing slash, the realname must also omit it.
#
# We include the /icons/ alias for FancyIndexed directory listings.  If you
# do not use FancyIndexing, you may comment this out.
#
Alias /icons/ "C:/Apache2/icons/"

<Directory "C:/Apache2/icons">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
返回列表