Home php教程 php手册 Windows下IIS6/Apache2.2.4+MySQL5.2+PHP5.2.1安装配置方法

Windows下IIS6/Apache2.2.4+MySQL5.2+PHP5.2.1安装配置方法

Jun 13, 2016 pm 12:31 PM
windows Down Install method Configuration

03年的时候就看过一本php的书,那时还是php3,回首四年php的在web开的的前景真还是一片光明啊!三年不见的php在去看已到了php5了,现在算起我真正从写第一个php的WEB开始距今还是有三四个月了,用工作之余正在进行www.kuomart.com网站的写做,回想当初一直用的是Windows2003+IIS6+PHP5.0.7+MYSQL4.1在进行开发,直到昨天机子重了木马,Kav也没查出个所以然,自己找也没有发现什么可疑暴露点,所以干脆重装了一下xp,由于TV1000电视卡只能在xp进才能正常运行,在2003系统下以前配置成功过一次,但是老实出现硬件出错蓝屏!所以干脆把2003下的我的开发环境的web开发部分也在xp下安装一部分。很想安装一下lamp环境,但考虑到机子上数据太多,操作起来麻烦,等有钱了再买个硬盘或都那天心血来潮再说吧。于是今天中午就开始配置环境!

 到http://www.apache.org下载了apache最新版本apache.2.24,安装后怎么也没找到服务,原来我选择了only第二项,选择这项需要手动添加windows服务!baidu了一下才搞明白,所以如果你是第一次安装就一直下一步不要进地设什么不必要的设置,运行一定会ok!
  接下来就是安装php了,我开始安装了php5.0.4,4,安装php我就不多说了,下面会把我找到的资料贴出来。然后就是对apache支持php的配置,当然是修改httpd.conf了,可是我

用记事本打开C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf这个文件进行修改: 
   ①找到:
AddType application/x-gzip .gz .tgz
   在下面添加以下几行:
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php4
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php-source .phps
AddType image/x-icon .ico 
   ②找到:
#LoadModule ssl_module modules/mod_ssl.so
   在下面添加一行:
LoadModule php5_module C:\php5\php5apache2_2.dll
   (特别提示:如果你的Apache版本为1.x的,此处应为:LoadModule php5_module C:\php5\php5apache.dll;如果你的Apache版本为2.0.x-2.2.x的,此处应为:LoadModule php5_module C:\php5\php5apache2.dll,我在此处费了好大周折才发现这点!) 
   ③找到:
DirectoryIndex index.php…
   这行,可以这样修改,添加默认的文件名:
DirectoryIndex index.php default.php index.htm index.html default.htm default.html

怎么出不正确加上LoadModule php5_module C:\php5\php5apache2_2.dll这句就出现
requested 错误

当然这种情况通常就是baidu或者google一下,原来是各种版本间的问题,我想应该是的,找到对应配置资料如下:

一.下载最新的Apache2.24,MySQL5.2,PHP5.2.1[下载地址:http://cn.php.net/downloads.php 注意:同时下载php-5.2.1-Win32和pecl-5.2.1-Win32(扩展包),格式是解压缩的那种,而不是exe或者msi等直接安装的那种。](具体地址请用baidu自行搜索)。

二.安装配置PHP5.2.1
   1.解压缩PHP5.2.1压缩包到C:\PHP5(这个路径和文件名都可以随意,不过以下要是用到这个路径和文件名,如果你用的不是该路径和文件名,请做相应的修改)。
   2.复制C:\PHP5目录下的以下文件到windows的系统文件夹里,文件夹视Windows版本的不同而不同(如果是Windows9x/ME,则为c:\windows\syste;如果是Windows NT/2000,则为c:\winnt\system32;如果是Windows XP/server2003,则为c:\windows\system32。其中C:\为你现在所使用的操作系统的系统盘,如果你目前操作系统不是安装在C:\windows下,请相应做出修改)
php5ts.dll
fdftk.dll
fribidi.dll
gds32.dll
libeay32.dll
libmcrypt.dll
libmhash.dll
libmysql.dll
libswish-e.dll
msql.dll
ntwdblib.dll
ssleay32.dll
yaz.dll
   3.把C:\PHP5目录下的文件php.ini-dist改名为php.ini(该配置文件自动给所有添加内容加上“//”,增加安全,同时也增加了麻烦;如果把php.ini-recommended改名为php.ini,该配置文件不给所添加内容加上“//”,减少了安全,但更加便利。选择哪个由你决定),复制php.ini到C:\windows\(XP/2003/9x/Me)或C:\Winnt\(2000/nt)下,用记事本打开,做如下几项修改: 
   ①搜索extension_dir= ./这行,并将其路径指到你的PHP目录下的extensions目录,修改为:extension_dir = C:\PHP5\ext 
   ②如若想支持更多模块,请接下面去做,如果不想的话,直接保存php.ini文件即可。 
   PHP所支持模块很多,不过有些dll不是免费的,所以没有随PHP的压缩包一起发布,不过dlls文件夹里带的就非常多了,刚才我们已经把它们复制到system32文件夹下了,现在我们测试看它支持多少模块。以下是我测试的结果,仅供参考,如果安装完毕后,弹出不支持xxx.dll模块的话,直接将前面分号加上去就可以了。搜索:
;Windows Extensions
;Note that MySQL and ODBC support is now built in, so no dll is needed for it.

   下面都用分号在前面注释掉了支持的扩展模块,如果你想PHP支持某个模块,请将前面的“;”去掉即可,下面是我测试后的结果,一般按照下面那样去掉注释后没什么问题的:
extension=php_bz2.dll
extension=php_cpdf.dll
extension=php_crack.dll
extension=php_curl.dll
extension=php_db.dll
extension=php_dba.dll
extension=php_dbase.dll
extension=php_dbx.dll
extension=php_domxml.dll
extension=php_exif.dll
extension=php_fdf.dll
extension=php_filepro.dll
extension=php_gd2.dll
extension=php_gettext.dll
extension=php_hyperwave.dll
extension=php_iconv.dll
;extension=php_ifx.dll
;extension=php_iisfunc.dll
extension=php_imap.dll
extension=php_interbase.dll
extension=php_java.dll
extension=php_ldap.dll
extension=php_mbstring.dll
;extension=php_mcrypt.dll
extension=php_mhash.dll
extension=php_mime_magic.dll
extension=php_ming.dll
extension=php_mssql.dll
extension=php_msql.dll
;extension=php_oci8.dll
extension=php_openssl.dll
;extension=php_oracle.dll
extension=php_pdf.dll
extension=php_pgsql.dll
;extension=php_printer.dll
extension=php_shmop.dll
extension=php_snmp.dll
extension=php_sockets.dll
;extension=php_sybase_ct.dll
extension=php_w32api.dll
extension=php_xmlrpc.dll
extension=php_xslt.dll
extension=php_yaz.dll
extension=php_zip.dll
修改完成后,保存php.ini。 
   ③解压缩pecl-5.2.1-Win32.rar包,将其中的所有文件复制到C:\PHP5\ext文件夹下。(该文件夹是PHP5.2.1的扩展文件存放之处,如果你用c语言编了PHP的扩展程序,也可以放到该文件夹下) 
   ④在C:\PHP5目录下新建一个文件夹,命名为:session。(该文件夹是用来保存session的,因为PHP没有类似ASP中的application那样的长驻内存的变量,所以对于保存初始查询条件以备翻页之用,或者做购物车的来说,session几乎是唯一可选的。不过该文件夹以后需要定期清理)

到此完成PHP的安装和配置。

三.Mysql的安装
   Mysql相对来说是比较独立的,这个数据库很小,不能直接对它进行操作,不像access或者SQL2000那样有图形化的管理工具,不过目前已经有很多图形化管理软件可以很好地操作它,比如:EMS SQL Manager 2005 for MySQL(强烈推荐 最优秀的MySQL管理软件),Navicat,phpMyAdmin,mysqlcc。这些软件可以到网上下载获得,在此不详细说明。
  1.下载获得Mysql的for win32安装包后,用winzip打开,直接运行setup.exe,需要注意的是选择一个安装路径,当然,安装路径可以任意,不过建议将它和PHP安装在一起,选择C:\MySQL目录。 
  2.安装完成后MySQL自动进入设置阶段。按照默认方式进行配置,最后输入密码,完成设置。(默认的用户名是root,密码为空) 
  3.一般装完MySQL后会自动启动服务,如果没有启动的话,请双击C:\MySQL\bin\mysqld-nt.exe运行即可。 
  4.如果你已经下载了上面提到的几个管理软件,就可用它们进行MySQL的管理了。

四.IIS的配置(与第五任选一项) 
  打开IIS,在“默认Web站点”上右键打开属性,在主目录里做如下图中的设置,注意步骤:


完成后IIS+PHP+MySQL的环境算是建立了。

五.Apache的安装配置(与第四任选一项) 
  如果你没有安装IIS,那么请装Apache这个小巧而强大的Web服务器,安装目录建议和PHP的目录一致,选择C:\。系统默认安装目录是C:\Program Files: 
  1.下载Apache2.2.4 for win32.Msi安装文件,直接双击它后就会自动执行Apache的安装了。 
  2.安装过程中,按照提示,从上到下第一个空行输入localhost,其余的两个空行分别输入你的名字和邮件地址(随便输入什么都行),完成安装配置。 
  安装完后会在桌面右下角系统托盘里显示apache的图标,双击可以打开Apache的控制面板,可以停止或者重起服务器。 
  3.Apache2.2.4的配置 
   用记事本打开C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf这个文件进行修改: 
   ①找到:
AddType application/x-gzip .gz .tgz
   在下面添加以下几行:
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php4
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php-source .phps
AddType image/x-icon .ico 
   ②找到:
#LoadModule ssl_module modules/mod_ssl.so
   在下面添加一行:
LoadModule php5_module C:\php5\php5apache2_2.dll
   (特别提示:如果你的Apache版本为1.x的,此处应为:LoadModule php5_module C:\php5\php5apache.dll;如果你的Apache版本为2.0.x-2.2.x的,此处应为:LoadModule php5_module C:\php5\php5apache2.dll,我在此处费了好大周折才发现这点!) 
   ③找到:
DirectoryIndex index.php…
   这行,可以这样修改,添加默认的文件名:
DirectoryIndex index.php default.php index.htm index.html default.htm default.html

保存文件,重起apache服务器。到此PHP的环境已经完全建立了。

六.Zend Optimizer安装配置(可选) 
  下载来后是一个.exe的文件,直接安装就可以了,安装过程要你选择PHP版本,一定要选择准确,这里我选择php5.2.1,完成安装之前提示是否备份php.ini,点确定后就结束安装了。 
  打开php.ini,修改一个地方:
找到:
[Zend]
在下面可以看到: 
zend_optimizer.optimization_level=*
这行,将“=”后面数值改为1023,也就是将这行改为: 
zend_optimizer.optimization_level=1023
保存后重起Apache/IIS,到此安装全部结束。

七.测试 
  用记事本新建个文件,写如下几行:
phpinfo();
?> 
  将文件改名为phpinfo.php,保存到C:\Apache Software Foundation\Apache2.2\htdocs目录下(该目录是你的站点根目录),然后在浏览器中输入http://localhost/phpinfo.php。 
  如果你可以看到相关的PHP信息,那就证明整个Windows下IIS6/Apache2.2.4+MySQL5.2+PHP5.2.1环境的安装配置工作胜利完成!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What should I do if I can't delete a Windows system dll file? Tips for completely deleting stubborn dll files What should I do if I can't delete a Windows system dll file? Tips for completely deleting stubborn dll files Jun 12, 2024 pm 02:46 PM

For some stubborn software, residual dll files will remain after uninstallation, and this dll file cannot be deleted. Some of them will be bound to the process (generally easy to bind to the expore.exe process) and start up when the computer is turned on. , when deleting a file, you will be prompted that a program is occupied (or a service is running, etc.). Method 1: 1. After pressing the win+r key, an interface will appear, and then enter regedit. The screenshot is as follows: 2. Then press Enter and we You will enter the Registry Editor, the screenshot is as follows: 3. At this time we will find the "HKEY_LOCAL_MACHINE" file in "My Computer", and then click to expand--SOFTWAR

Lossless Scaling on Steam Deck OLED runs games at up to 2x FPS Lossless Scaling on Steam Deck OLED runs games at up to 2x FPS Aug 26, 2024 am 10:07 AM

ETA Prime recently showcased a paid software called Lossless Scaling on ROG Ally X. While it doesn't actually improve the actual gaming performance, the software enhances the experience by adding frame generation and resolution scaling. These two can

The secret of hatching mobile dragon eggs is revealed (step by step to teach you how to successfully hatch mobile dragon eggs) The secret of hatching mobile dragon eggs is revealed (step by step to teach you how to successfully hatch mobile dragon eggs) May 04, 2024 pm 06:01 PM

Mobile games have become an integral part of people's lives with the development of technology. It has attracted the attention of many players with its cute dragon egg image and interesting hatching process, and one of the games that has attracted much attention is the mobile version of Dragon Egg. To help players better cultivate and grow their own dragons in the game, this article will introduce to you how to hatch dragon eggs in the mobile version. 1. Choose the appropriate type of dragon egg. Players need to carefully choose the type of dragon egg that they like and suit themselves, based on the different types of dragon egg attributes and abilities provided in the game. 2. Upgrade the level of the incubation machine. Players need to improve the level of the incubation machine by completing tasks and collecting props. The level of the incubation machine determines the hatching speed and hatching success rate. 3. Collect the resources required for hatching. Players need to be in the game

How to set font size on mobile phone (easily adjust font size on mobile phone) How to set font size on mobile phone (easily adjust font size on mobile phone) May 07, 2024 pm 03:34 PM

Setting font size has become an important personalization requirement as mobile phones become an important tool in people's daily lives. In order to meet the needs of different users, this article will introduce how to improve the mobile phone use experience and adjust the font size of the mobile phone through simple operations. Why do you need to adjust the font size of your mobile phone - Adjusting the font size can make the text clearer and easier to read - Suitable for the reading needs of users of different ages - Convenient for users with poor vision to use the font size setting function of the mobile phone system - How to enter the system settings interface - In Find and enter the "Display" option in the settings interface - find the "Font Size" option and adjust it. Adjust the font size with a third-party application - download and install an application that supports font size adjustment - open the application and enter the relevant settings interface - according to the individual

deepseek web version entrance deepseek official website entrance deepseek web version entrance deepseek official website entrance Feb 19, 2025 pm 04:54 PM

DeepSeek is a powerful intelligent search and analysis tool that provides two access methods: web version and official website. The web version is convenient and efficient, and can be used without installation; the official website provides comprehensive product information, download resources and support services. Whether individuals or corporate users, they can easily obtain and analyze massive data through DeepSeek to improve work efficiency, assist decision-making and promote innovation.

How to update the latest version of Bybit Exchange? Will there be any impact if it is not updated? How to update the latest version of Bybit Exchange? Will there be any impact if it is not updated? Feb 21, 2025 pm 10:54 PM

The way to update ByBit exchanges varies by platform and device: Mobile: Check for updates and install in the app store. Desktop Client: Check for updates in the Help menu and install automatically. Web page: You need to manually access the official website for updates. Failure to update the exchange can lead to security vulnerabilities, functional limitations, compatibility issues and reduced transaction execution efficiency.

How to choose a mobile phone screen protector to protect your mobile phone screen (several key points and tips for purchasing mobile phone screen protectors) How to choose a mobile phone screen protector to protect your mobile phone screen (several key points and tips for purchasing mobile phone screen protectors) May 07, 2024 pm 05:55 PM

Mobile phone film has become one of the indispensable accessories with the popularity of smartphones. To extend its service life, choose a suitable mobile phone film to protect the mobile phone screen. To help readers choose the most suitable mobile phone film for themselves, this article will introduce several key points and techniques for purchasing mobile phone film. Understand the materials and types of mobile phone films: PET film, TPU, etc. Mobile phone films are made of a variety of materials, including tempered glass. PET film is relatively soft, tempered glass film has good scratch resistance, and TPU has good shock-proof performance. It can be decided based on personal preference and needs when choosing. Consider the degree of screen protection. Different types of mobile phone films have different degrees of screen protection. PET film mainly plays an anti-scratch role, while tempered glass film has better drop resistance. You can choose to have better

Pi Node Teaching: What is a Pi Node? How to install and set up Pi Node? Pi Node Teaching: What is a Pi Node? How to install and set up Pi Node? Mar 05, 2025 pm 05:57 PM

Detailed explanation and installation guide for PiNetwork nodes This article will introduce the PiNetwork ecosystem in detail - Pi nodes, a key role in the PiNetwork ecosystem, and provide complete steps for installation and configuration. After the launch of the PiNetwork blockchain test network, Pi nodes have become an important part of many pioneers actively participating in the testing, preparing for the upcoming main network release. If you don’t know PiNetwork yet, please refer to what is Picoin? What is the price for listing? Pi usage, mining and security analysis. What is PiNetwork? The PiNetwork project started in 2019 and owns its exclusive cryptocurrency Pi Coin. The project aims to create a one that everyone can participate

See all articles