使用IIS或Apache做PHP的服务器

http://tech.ddvip.com   2007年08月24日    社区交流

内容摘要:使用IIS或Apache做PHP的服务器

  Aphache做服务器:

  安装 Apache 并进行配置使其支持 Php

  将 Apache 安装在 d:websiteapache 目录中。Apache 安装过程需要输入网站域名,本地调试使用localhost即可,安装过程很简单,全图形化界面,不再赘述。

  PHP解压缩到 d:websitephp 目录中

  然后找到 d:websitephpphp.ini-dist 文件,将其重命名为 php.ini,并复制到 c:windows 目录里。

  再将 d:websitephp 目录中的 php5ts.dll 和 libMySQL.dll 两个文件,一起复制到 c:windowssystem 或 c:windowssystem32 目录中。

  编辑 d:apacheapache2confhttpd.conf 文件:

  首先找到 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:apacheconfhttpd.conf 文件:

  找到 #LoadModule ssl_module modules/mod_ssl.so 这行,在此行后增加一行:

  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 的安装目录路径,请视具体情况更改。

  重新启动 Apache 服务。

  到这里,Apache + Php 环境基本已经配置完成,在 web 根目录(以上例即 d:websitepublic_html 目录)中,用记事本创建一个 phpinfo.php 文件,其内容如下:

  <?

  echo phpinfo();

  ?>

  然后,在浏览器中打开 http://localhost/phpinfo.php ,如果看到 Php 配置输出信息,就说明配置正常。

  IIS上运行PHP

  1.

  默认网站--属性--主目录--配置--添加

  添加应用程序扩展名映射:

  可执行文件:C:phpphp.exe %s %s

  扩展名:.php

  选定:脚本引擎、检查文件是否存在

  2.

  默认网站--属性--主目录--文档-添加

  index.php

  或者:

  默认网站--属性--主目录--配置--添加

  C:phpphp5isapi.dll

  .PHP

责编:豆豆技术应用

正在加载评论...