|
怎样用IIS或Apache做PHP的服务器
Aphache做服务器:phpma.com
安装 Apache 并进行配置使其支持 Php
将 Apache 安装在 d:\website\apache 目录中。Apache 安装过程需要输入网站域名,本地调试使用localhost即可,安装过程很简单,全图形化界面,不再赘述。
PHP解压缩到 d:\website\php 目录中phpma.com 然后找到 d:\website\php\php.ini-dist 文件,将其重命名为 php.ini,并复制到 c:\windows 目录里。 再将 d:\website\php\ 目录中的 php5ts.dll 和 libMySQL.dll 两个文件,一起复制到 c:\windows\system 或 c:\windows\system32 目录中。
编辑 d:\apache\apache2\conf\httpd.conf 文件:phpma.com 首先找到 DocumentRoot 一行,将其后的路径修改为 web 服务的主目录,例如:DocumentRoot "D:/website/public_html"; 然后找到 DirectoryIndex 一行,在行末加上 index.htm index.php,例如:DirectoryIndex index.html index.html.var index.htm index.php
为 Apache 安装 Php: 编辑 d:\apache\conf\httpd.conf 文件:phpma.com
找到 #LoadModule ssl_module modules/mod_ssl.so 这行,在此行后增加一行:phpma.com LoadModule php5_module d:/website/php/php5apache2.dll
找到 AddType application/x-gzip .gz .tgz,在此行后增加三行: ScriptAlias /php/ "d:/website/php/" AddType application/x-httpd-php .php Action application/x-httpd-php "/php/php-cgi.exe"
d:/website/php/ 是指 php 5.03 的安装目录路径,请视具体情况更改。phpma.com
重新启动 Apache 服务。phpma.com
到这里,Apache + Php 环境基本已经配置完成,在 web 根目录(以上例即 d:\website\public_html\ 目录)中,用记事本创建一个 phpinfo.php 文件,其内容如下:
<? echo phpinfo(); ?>
然后,在浏览器中打开 http://localhost/phpinfo.php ,如果看到 Php 配置输出信息,就说明配置正常。
IIS上运行PHPphpma.com 1. 默认网站--属性--主目录--配置--添加 添加应用程序扩展名映射: 可执行文件:C:\php\php.exe %s %s 扩展名:.php 选定:脚本引擎、检查文件是否存在 2. 默认网站--属性--主目录--文档-添加 index.php
或者:phpma.com 默认网站--属性--主目录--配置--添加 C:\php\php5isapi.dll .PHP
(阅读次数:)
|