Windows 下 Apache2.2 + PHP5.2 配置
一、安装Apache,配置成功服务器 先下载安装版 Apache2.2(no_ssl)的 msi 文件,直接安装就可以了。 这里有一个选择配置选项,以前可能要配置,现在好像修正过来了,不用配置了,就是强制所有输出文件的语言编码,html文件里有语言标记(这个就是设定文档语
一、安装Apache,配置成功服务器
先下载安装版 Apache2.2(no_ssl)的 msi 文件,直接安装就可以了。
这里有一个选择配置选项,以前可能要配置,现在好像修正过来了,不用配置了,就是强制所有输出文件的语言编码,html文件里有语言标记(这个就是设定文档语言为gb2312)的也会强制转换。如果打开的网页出现乱码,请先检查网页内有没有上述 html语言标记,如果没有,添加上去就能正常显示了。把“# DefaultLanguage nl”前面的“# ”去掉,把“nl”改成你要强制输出的语言,中文是“zh-cn”,保存,关闭。
二、php的安装(以module方式)
将下载的php安装文件“php-5.2.17-nts-Win32-VC6-x86.zip”解压缩到“C:/php”下。
1、配置PHP的“php.ini”文件
解压缩后的文件夹内容,找到“php.ini-recommended”文件,将其重命名为“php.ini”
将 extension_dir 改为 php/ext 所在目录,如 "C:\php\ext";
将 doc_root 改为第一步中的同样目录,如 "C:\Apache2.2\htdocs";
找到 ;session.save_path = "/tmp" 将 ; 去掉,设置你保存 session 的目录,如 session.save_path = "C:/php/session_temp"
然后把下面几句前面的分号去掉,以更好支持Mysql and PHPmyadmin
extension=php_mbstring.dll
extension=php_gd2.dll
extension=php_mysql.dll
找到Ln385,有一个“register_globals = Off”值,这个值是用来打开全局变量的,比如表单送过来的值,如果这个值设为“Off”,就只能用“$_POST['变量名']、$_GET['变量名 ']”等来取得送过来的值,如果设为“On”,就可以直接使用“$变量名”来获取送过来的值,当然,设为“Off”就比较安全,不会让人轻易将网页间传送的数据截取。这个值是否改成“On”就看自己感觉了,是安全重要还是方便重要?
这里还有一个地方要编辑,功能就是使php能够直接调用其它模块,Ln563,选择要加载的模块,去掉前面的 “;”,就表示要加载此模块了,加载的越多,占用的资源也就多一点,不过也多不到哪去,比如我要用mysql,就要把“;extension= php_mysql.dll”前的“;”去掉。所有的模块文件都放在php解压缩目录的“ext”之下,编辑好后保存,关闭。
2、配置PHP的“httpd.conf”文件
现在开始将 php 以 module 方式与 Apache 相结合,使 php 融入 Apache,在C:\Apache2.2\conf\ 下用文本编辑器打开 Apache 的配置文件 httpd.conf 文件,Ln 173,找到这里,添加进下面的三行:
第一行 LoadModule php5_module "C:/php/php5apache2_2.dll" 是指以module方式加载php,
第二行 PHPIniDir "C:/php" 是指明php的配置文件 php.ini 的位置。(做了这一步就不需要将 php.ini 复制到 Windows/system32 目录下了)
第三行 AddType application/x-httpd-php .php 是指添加可以执行php的文件类型,比如你再加上一行“AddType application/x-httpd-php .htm”,则.htm文件也可以执行php程序了,你甚至还可以添加上一行“AddType application/x-httpd-php .txt”,让普通的文本文件格式也能运行php程序。
(以下步骤可以不需要)
——如果你出于某种原因而需要在CGI模式中运行PHP程序(使用Php.exe),
请将上面这一行变成注释(各行头加#即可),添加下面这些行:
# ScriptAlias /php/ "d:/phpapache/php/"
# AddType application/x-httpd-php .php
Action application/x-httpd-php "/php/php-cgi.exe"
3、配置文件和系统变量(以下方法选一种即可)
如果 Apache 加载了其它模块,就要指明模块的位置,否则重启Apache的时候会提示“找不到指定模块”的错误
方法一:在 C:\PHP 里找到 php5ts.dll libmysql.dll 将其复制到 c:\winnt\system32 下(winNT/2000的机器),而 winXP/2003 是复制到 c:\windows\system32 下。
方法二:在 Apache 的配置文件 httpd.conf 里添加 LoadFile "C:/PHP/libmysql.dll" 和 LoadFile "C:/PHP/libmcrypt.dll",直接指定加载模块,示例:
LoadModule php5_module C:/PHP/php5apache2_2.dll
PHPIniDir "C:/PHP"
AddType application/x-httpd-php .php
LoadFile "C:/PHP/libmysql.dll"
LoadFile "C:/PHP/libmcrypt.dll"
4、重起操作系统或 Apache 服务
三、测试Apache与php是否连接成功
在Web根目录下新建test.php(即 \Apache2.2\htdocs 目下)
phpinfo();
?>
运行http://localhost/test.php
如果成功,则应该看到一个含有PHP徽标的网页,其中包含大量设置和其他信息
那么恭喜你!!!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



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.

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

The official website entrance of the Coinsuper Exchange: https://www.coinsuper.com. The client download channels are: Windows client, macOS client, and mobile (iOS/Android). Registration requires an email, mobile phone number and password, and you need to complete real-name authentication before you can trade. The platform provides a variety of digital asset transactions, including Bitcoin, Ethereum, etc., with the transaction fee rate of 0.1% for both orders and acceptors. Security safeguards include cold wallet storage, dual-factor verification, anti-money laundering and anti-terrorism financing measures, and with security public

Need to download the Gate.io app to start your cryptocurrency journey? This guide details the latest version download steps for iOS, Android, and Windows devices. Simply visit the official website, find the download link and select the appropriate option based on your device. For iOS, it will go directly to the App Store, while Android and Windows users will download the APK or installer for manual installation. Once installed, you can launch the app and set up your account to step into the world of cryptocurrency.

Solve the problem of third-party interface returning 403 in Node.js environment. When we use Node.js to call third-party interfaces, we sometimes encounter an error of 403 from the interface returning 403...

Turbo Virtual Currency Exchange is a well-known digital asset trading platform that provides a variety of convenient trading services and a rich cryptocurrency trading pairs. If you want to download the Turbo virtual currency exchange, you can follow the tutorial below to quickly and easily experience the convenience of digital currency trading.

The OKX trading platform can be downloaded through mobile devices (Android and iOS) and computers (Windows and macOS). 1. Android users can download it from the official website or Google Play, and they need to pay attention to security settings. 2. iOS users can download it through the App Store or follow the official announcement to obtain other methods. 3. Computer users can download the client of the corresponding system from the official website. Always make sure to use official channels when downloading, and register, log in and security settings after installation.

Choosing the right Bitcoin market viewing software is crucial, it can help investors grasp market conditions in real time and make smarter investment decisions. This article will guide you how to make a choice, covering personal needs assessment (trading frequency, analysis depth, information needs and budget), software type selection (exchange interface, professional software, market website/APP), core functional considerations (data reliability, chart tools, custom settings, community communication and platform compatibility), and direction recommendations (maturity financial platform, cryptocurrency aggregation platform, community recommendation software). Finally, it is recommended that you try a few more software and compare it to choose the tool that best suits your needs. Please remember that software is only an auxiliary tool, and you must be cautious when investing at your own risk.
