请问apache+php,如何建立虚拟目录?(急)
时间:2007-03-22
来源:互联网
即安装apache的htdocs文件夹下,这样很不方便,我想自已建立一个路径,比如:
e:\web
并建立虚拟目录,在网上查了很久,配置都不成功。请高人指点我一下,多谢!
另外我是初学,所以用的是windows的系统。
作者: fivehun 发布时间: 2007-03-22
DocumentRoot=“D:\Apache2.2\htdocs”这行,将D:\Apache2.2\htdocs改为e:\web
然后重启Apache就可以了
作者: poor365 发布时间: 2007-03-22
还有一个的那
自己搜一下
作者: shenhuozaibeijing 发布时间: 2007-03-22
但并不能正常运行。
我用的是apache2.2版本
作者: fivehun 发布时间: 2007-03-22
1.解压缩PHP压缩包到C:\php\
2.复制C:\php\目录下的php4ts.dll及C:\php\dlls目录下的所有文件到windows安装目录的系统文件夹里
(win9x/me是system目录,winNT,2k/winXP,2003是system32目录)
复制C:\php\php.ini-dist到windows安装目录下(如:c:\windows),并将其改名为php.ini。用记事本打开,修改一下信息:
搜索extension_dir = ./ 这行,并将其路径指到你的PHP目录下的extensions目录,比如:
extension_dir = C:\php\extensions
如若想支持更多模块,,搜索:
;Windows Extensions
;Note that MySQL and ODBC support is now built in, so no dll is needed for it.
;
下面都用分号在前面注释掉了支持的扩展模块,如果你想PHP支持某个模块,请将前面的“;”去掉即可
修改完成后,保存php.ini,到此完成PHP的安装和配置。
我们在下面加入一行
extension=php_mysql.dll
//Note 1: The extension dir need not be ".\ ", as Hermawan mentioned. It works fine for me with the extensions subdir where the other extensions are located.
//Note 2: The php.ini file need not be in the Apache root, as lars mentioned. It works fine for me in the Windows dir.
<2> 安装Apach2
1.备份 C:\Program Files\Apache Group\Apache2\conf\httpd.conf 文件。
2.用记事本打开C:\Program Files\Apache Group\Apache2\conf\httpd.conf
找到:
#NameVirtualHost *
修改为:
NameVirtualHost 127.0.0.1 //或localhost
找到:
<VirtualHost 127.0.0.1>
修改下面几行:
ServerAdmin (你刚才安装时候输入的管理员信箱)
DocumentRoot C:\Program Files\Apache Group\Apache2\htdocs
ServerName Apache2
ErrorLog C:\Program Files\Apache Group\Apache2\logs\error_log
CustomLog C:\Program Files\Apache Group\Apache2\logs\access_log common
</VirtualHost>
找到:
AddType application/x-tar .tgz
在下面添加以下两行:
AddType application/x-httpd-php .php
AddType image/x-icon .ico
找到:
#LoadModule ssl_module modules/mod_ssl.so
在下面添加一行:
LoadModule php5_module C:\php\sapi\php4apache2.dll //这里php5_module是关键,如果php4_module apache就无法启动了
增加默认文件:
找到DirectoryIndex * 这行,可以这样修改,添加默认的文件名:
DirectoryIndex index.php default.php index.htm index.html default.htm default.html
保存文件,重起apache服务器。
最后,在该文件末尾加上下面两行
ScriptAlias /php/ "c:/php/ "
Action application/x-httpd-php "/php/php.exe“
到此Apache的PHP环境已经完全建立了。
作者: jianye112 发布时间: 2007-03-22
但我只想知道需要修改哪里。因为我的PHP页面已经可以正常运行了。
作者: fivehun 发布时间: 2007-03-22
ServerRoot "D:/Apache2.2 "
Listen 80
ServerName localhost:80
DocumentRoot "e:/myweb/php "
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Satisfy all
</Directory>
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
#虚拟目录设置
Alias /test/ "e:/myweb/PHP/test "
<Directory "e:/myweb/PHP/test ">
Options Indexes FollowSymlinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
为何不能访问虚拟目录test下的php文件呢?
作者: fivehun 发布时间: 2007-03-22
这里需要注掉
#DocumentRoot "e:/myweb/php "
#虚拟目录设置
Alias /test/ "e:/myweb/PHP/test/ "
<Directory "e:/myweb/PHP/test/ ">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
作者: fivehun 发布时间: 2007-03-22
然后把原来的
DocumentRoot=“D:\Apache2.2\htdocs”
这一行注释掉就OK了哈
作者: qingxianyan 发布时间: 2008-08-06
Alias /test/ "e:/myweb/PHP/test/ "
<Directory "e:/myweb/PHP/test/ ">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
请教下楼主,这一长串参数有什么意义?可由文档参考。
作者: lvxiangyang 发布时间: 2008-08-29
终于明白了
大哥。你真是大哥
作者: liyangmsn 发布时间: 2008-10-08
#Alias "/ad" "f:/b"
虚拟目录 路径
作者: mengshan1986 发布时间: 2008-10-09
作者: iasky 发布时间: 2008-10-12
作者: worinimarijiurisi 发布时间: 2009-10-28
#虚拟目录设置
Alias /test/ "e:/myweb/PHP/test/ "
<Directory "e:/myweb/PHP/test/ ">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
请教下楼主,这一长串参数有什么意义?可由文档参……
作者: wangluo2008 发布时间: 2011-03-16
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28