Apache virtual contents configuratiion

Apache  virtual contents configuratiion

在IIS和PWS中,该设置是通过图形界面进行的,在Apache中是编辑httpd.conf文件(该文件一般不要轻易改动),在该文件中加一行

Alias /test/ "c:/php/test/"

表示将c:/php/test/目录设置为虚拟目录/test/,那么在c:/php/test/下的文件,就可以通过在浏览器中输入“http://117.0.0.1/test/文件”访问。

   使Apache支持PHP

使Apache支持PHP,还需以下配置

在httpd.conf文件中加入以下几行:

ScriptAlias /php3/ "c:/php3/"
AddType application/x-httpd-php3 .php
Action application/x-httpd-php3 "/php3/php.exe"

如果想将php文件后缀改为其它的也可以,将第二行中的最后几个字“.php”改为想要的后缀即可,

想支持更多的文件,也可以,eg:

ScriptAlias /php3/ "c:/php3/"
AddType application/x-httpd-php3 .php
AddType application/x-httpd-php3 .php3
AddType application/x-httpd-php3 .phtml
Action application/x-httpd-php3 "/php3/php.exe"

 then,reboot  Apache,and do a test 。

write a simple php file (hello.php) under the virtual contents of "test"

<?

echo "Hello World!";

?>

enter  "http://117.0.0.1/test/hello.php"  in the address,

use

<? phpinfo() ?> 

to check the php  configuration.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值