Home php教程 php手册 Apache2 + Php5 + MySQL5 Windows配置

Apache2 + Php5 + MySQL5 Windows配置

Jun 06, 2016 pm 07:48 PM
php5 windows Configuration

First,set up Apache2+Php5 第一、安装并配置APACHE(以我的为例,安装到E:\Program Files\Apache Software Foundation\Apache2.2) 1、安装时默认安装,Network Domain, Server Name 我填写我的计算机名,Administrator's Email Address区域填你的邮件地址

First,set up Apache2+Php5

第一、安装并配置APACHE(以我的为例,安装到E:\Program Files\Apache Software Foundation\Apache2.2)
1、安装时默认安装,Network Domain, Server Name 我填写我的计算机名,Administrator's Email Address区域填你的邮件地址
2、安装完后在安装目录下有个conf文件夹,打开httpd.conf文件进行配置
·找到 DocumentRoot ,将其设置为你所要存放php, htm等网页文件的文件夹,如 "E:\Program Files\Apache Software Foundation\Apache2.2\htdocs";
·找到 DirectoryIndex ,在index.html后添加index.php, index.htm等,以单个空格将其分开;
·重启Apache,用http://localhost或http://127.0.0.1或http://yourcompanyname测试是否成功。成功的话屏幕会有个It works!
第二、安装配置PHP(解压PHP压缩包到d:\php\)
1、将php.ini-recommended文件重命名为php.ini并将其剪到系统所在目录下(如放在2000/NT的WINNT/system32, XP的Windows/system32目录下),
2、将extension_dir 改为php/ext所在目录,如 "d:\php\ext";
3、将doc_root 改为第一步中的同样目录,如 "E:\Program Files\Apache Software Foundation\Apache2.2\htdocs";
4、找到 ;session.save_path = "/tmp" ,将';'去掉,设置你保存session的目录,如session.save_path = "D:/php/session_temp";
5、然后把下面几句前面的分号去掉,以更好支持Mysql and PHPmyadmin
      extension=php_mbstring.dll
      extension=php_gd2.dll
      extension=php_mysql.dll
第三、PHP+APACHE
1、允许Apache将PHP程序作为模块来运行:
      打开httpd.conf,添加下面内容(位置任意):
      LoadModule php5_module "d:/php/php5apache2_2.dll"(特别注意这一条,很多地方是调用php5apache2.dll,这样在运行PHP代码时会提示httpd.exe应用程序错误)
      AddType application/x-httpd-php .php
      AddType application/x-httpd-php .htm
      (.htm, .php为可执行php语言的扩展名,也可加html, php3, php4,甚至txt)
(以下两步可以不需要)
2、如果你出于某种原因而需要在CGI模式中运行PHP程序(使用Php.exe),
      请将上面这一行变成注释(各行头加#即可),添加下面这些行:
      #     ScriptAlias /php/ "d:/php/"
      # AddType application/x-httpd-php .php
      #Action application/x-httpd-php "/php/php-cgi.exe"
3、现在apache 2 支持HTML而不支持PHP,先把下面几句加到d:\apache2\conf\httpd.conf去:
      # ScriptAlias /php/ "d:/php/"
      # AddType application/x-httpd-php .php
      #Action application/x-httpd-php "/php/php-cgi.exe"
   
第四、重起服务
1、在d:\PHP里找到php5ts.dll,libmysql.dll将其复制到c:\winnt\system32下(winNT/2000的机器),而winXP/2003是复制到c:\windows\system32下
2、测试Apache与php是否连接成功:
     启动start apache服务或者正在运行的就重新启动restart apache
3、在Web根目录下新建test.php(即E:\Program Files\Apache Software Foundation\Apache2.2\htdocs目下)

test

phpinfo();
?>

4、运行http://localhost/test.php
如果成功,则应该看到一个含有PHP徽标的网页,其中包含大量设置和其他信息
那么恭喜你

备注:
如果不能运行,使用传统的模块化方法安装PHP5.1.* + apache 2.2.2 后不能启动,

提示:
"Cannot load D:/php/php5apache2.dll into server: The specified module could not be found."

原因:

PHP压缩包里的php5apache2.dll只适用于apache2.0.*,是否把php5apache2.dll改为php5apache2_2.dll即第三步的第1小步
另外的解决方法:

下载(http://www.phpv.net/php5apache2.dll-php5.1.x.rar) 并解压.共有三个文件.

vcredist_x86.exe
php5apache2.dll
httpd.exe.manifest
1.将 php5apache2.dll 覆盖掉你原来PHP目录下的 php5apache2.dll 文件.
2.将 httpd.exe.manifest 文件复制到你的apache安装目录下的bin文件夹下.
3.双击运行vcredist_x86.exe安装.
完成!去重启你的apache试试吧.

Second,set up MySQL5

  安装好MySql后,找到刚刚安装Php5 目录里面的php.ini

 除了php.ini里面的去掉分号问题以外还要看里面的extension_dir 改为php/ext所在目录。

最后别忘了复制一份到windows目录下。


C盘下mysql目录权限也要加入users的  读取和运行+列出文件夹目录+读取  等权限。

最后重启apache服务,在浏览器按F5刷新就可以顺利安装了。

 

Last,I succeed,if you have any trouble,please google.

 if you want to debug php application,just set up vs.php for visual studio 2008

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
4 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)

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

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.

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.

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

How to install deepseek How to install deepseek Feb 19, 2025 pm 05:48 PM

There are many ways to install DeepSeek, including: compile from source (for experienced developers) using precompiled packages (for Windows users) using Docker containers (for most convenient, no need to worry about compatibility) No matter which method you choose, Please read the official documents carefully and prepare them fully to avoid unnecessary trouble.

Microsoft introduces gaming handheld-friendly Compact Mode for Xbox Game Bar Microsoft introduces gaming handheld-friendly Compact Mode for Xbox Game Bar Aug 15, 2024 am 06:32 AM

Microsoft has just announced a new Compact Mode for Xbox Game Bar, with a focus on making the overlay more usable on Windows gaming handhelds. These devices usually come with screens that are smaller than 9 inches, and things that are designed for re

Coinsuper exchange software channel official website entrance Coinsuper exchange software channel official website entrance Feb 21, 2025 pm 10:39 PM

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

BITGet official website installation (2025 beginner's guide) BITGet official website installation (2025 beginner's guide) Feb 21, 2025 pm 08:42 PM

BITGet is a cryptocurrency exchange that provides a variety of trading services including spot trading, contract trading and derivatives. Founded in 2018, the exchange is headquartered in Singapore and is committed to providing users with a safe and reliable trading platform. BITGet offers a variety of trading pairs, including BTC/USDT, ETH/USDT and XRP/USDT. Additionally, the exchange has a reputation for security and liquidity and offers a variety of features such as premium order types, leveraged trading and 24/7 customer support.

See all articles