现在的位置: 首页 > 综合 > 正文

PHP 安装步骤详解

2018年04月18日 ⁄ 综合 ⁄ 共 1420字 ⁄ 字号 评论关闭

昨天,在本机(win7-x64)上安装了一个WAMP (windows apache2.4 mysql php5.5)环境,步骤如下:

1、分别下载 apache (http://www.apachelounge.com/download/win64/)mysql(http://www.mysql.com/downloads/mysql/
php(http://windows.php.net/download/)

注意:

Apache2.4.4需要VC10库支持,Microsoft Visual C++ 2010 SP1 Redistributable Package (x64)

PHP5.5.0beta2需要VC11库支持,Visual C++ Redistributable for Visual Studio 2012 Update 1

2、安装Apache(将zip 包解压到D盘根目录下的Apache24下)

I )打开D:\Apache24\conf下httpd.conf  。

ServerRoot "c:/Apache24"改为ServerRoot “D:/Apache24”;//Apache程序的位置。

ServerName前面的“#”号去掉;

DocumentRoot "c:/Apache24/htdocs"改为DocumentRoot "D:/Apache24/htdocs";//网站的根目录

<Directory "c:/Apache24/htdocs">改为<Directory " D:/Apache24/htdocs">;

DirectoryIndex index.html改为DirectoryIndex index.html index.php index.htm   //支持更多的默认页

 ScriptAlias /cgi-bin/ "c:/Apache24/cgi-bin/"改为ScriptAlias /cgi-bin/ "D:/Apache24/cgi-bin/"

<Directory "c:/Apache24/cgi-bin">改为<Directory "D:/Apache24/cgi-bin">

II)通过 CMD 命令行,启动Apache服务(将目录放至Apache24/bin 下,敲httpd, enter 回车)。具体命令如下:

d:
cd Apache24\bin
httpd

如果httpd 配置正确,不会有提示。浏览器访问127.0.0.1 出现“It works”说明apache已经正确安装。

III)把Apache加入系统服务【可以通过
apache24/bin 下的工具 monitorApache.exe启动或停止服
务】,配置命令如下:

d:
cd Apache24\bin
httpd.exe -k install -n "自定义的服务名"

3、安装PHP

I)打开Apache24\conf下httpd.conf,添加以下配置信息:

# php5 support
LoadModule php5_module "d:/php/php5apache2_4.dll"
AddType application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "d:/php"

II)重启 Apache 服务器。文件夹D:/Apache24/htdocs新建index.php,内容为<?php
phpinfo(); ?>保存,
访问index.php出现php的信息就说明php已经成功安装

抱歉!评论已关闭.