php install guide (old version)

来源:互联网 发布:手机壁纸软件哪个好 编辑:程序博客网 时间:2024/06/16 00:18

Assume the php zip file is extracted to E:/develop/php/php5.2.6

 

1. 进入 php 的安装目录,将 php.ini-dist 或 php.ini-recommended 复制一份,命名为 php.ini。然后打开 php.ini

 

    1)找到:
;extension=php_mysql.dll
将前面的;号去掉

 

    2)找到:
extension_dir = "./"
将其改为你的php安装目录下ext子目录的绝对路径。例如
extension_dir = "E:/develop/php/php5.2.6/ext"


2.在“控制面板”->“系统”->“高级”->“环境变量”,在“系统变量”里面找到path,编辑path的变量值,添加你的php目录E:/develop/php/php5.2.6

 

3.配置 Apache 和 PHP

打开 Apache 安装目录下的 conf 子目录中的 httpd.conf 文件

    1)找到:
DocumentRoot "xxxxxxx"
改成你本机的网站内容的目录。例如我的:
DocumentRoot "E:/develop/ApacheWebRoot"

 

    2)找到 LoadModule,根据你的 php 安装目录,在下面空白处加上这两行
LoadModule php5_module "E:/develop/php/php5.2.6/php5apache2_2.dll"
PHPIniDir "E:/develop/php/php5.2.6"

 

    3)找到:
DirectoryIndex index.html
修改为:
DirectoryIndex index.php index.html

 

    4)找到:
AddType application/x-gzip .gz .tgz
添加这两行:
AddType application/x-httpd-php .php
AddType application/x-httpd-php .html

 

    5)找到:
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>
改成:
<Directory />
    Options Indexes FollowSymLinks
    AllowOverride None
</Directory>

如果没有这一步,访问页面时会有error: You don't have permission to access / on this server.

 

    6) Save httpd.conf file

 

4 在你的网站目录中(例如我的是 E:/develop/ApacheWebRoot),create a index.php file:
<?php
phpinfo();
?>

 

5. restart apache server, and then try http://localhost/index.php

原创粉丝点击