环境是
apache2.2
php5.4
在apache的安装目录下的htdosc是我的web根目录.
我在里面创建的项目不能解析php文件.会提示连接被重置!或网络已断开.在地址栏输入这个路径只能看到当前目录下的文件.
而根目录的index.php却能正常解析.
有时候自己就好了.很奇怪啊.
我觉得是httpd.conf的配置有问题.看了又找不出原因.我对apache的配置不是很懂.
请各位哥哥帮帮我.
回复讨论(解决方案) httpd.conf可解析的文件扩展名:
typesconfig conf/mime.types
addtype application/x-compress .z
addtype application/x-gzip .gz .tgz
addtype application/x-httpd-php-source .phps
addtype application/x-httpd-php .php .phtml .vcgi
addhandler type-map var
httpd.conf可解析的文件扩展名:
typesconfig conf/mime.types
addtype application/x-compress .z
addtype application/x-gzip .gz .tgz
add……
你这里面有两条我配置里没有.我添加进去重启.没什么效果.应该不是块的问题.
你的什么系统
win7
早说啊,我上面那个是linux下的apache的配置文件,你看看这个和你的哪里不一样:
wamp-windows_apache_mysql_php相关配置及搭建环境
不行啊. 常规配置我知道的.
根目录的.php文件就可以解析.到了子目录就不能解析了.如果子目录没有index.php那么浏览器就会列出所有子目录下的文件.如果有这个index.php,浏览器提示连接被重置,连接断开.
不是吧,按照#5文档修改的httpd.conf文件不会出现你这样的问题啊。是不是你哪里写重复了?或者没有写规范?和安装好的httpd.conf对比一下。
检查apache错误日志,看报什么错。
htdocs本来就是放静态文件的
动态文件,例如php放cgi-bin里
google关键字:apache scriptalias
我是win7下的wamp环境,运行ok,如果需要,留个mail,我把我的发给你。
defaulttype text/plain # # typesconfig points to the file containing the list of mappings from # filename extension to mime-type. # typesconfig conf/mime.types # # addtype allows you to add to or override the mime configuration # file specified in typesconfig for specific file types. # #addtype application/x-gzip .tgz # # addencoding allows you to have certain browsers uncompress # information on the fly. note: not all browsers support this. # #addencoding x-compress .z #addencoding x-gzip .gz .tgz # # if the addencoding directives above are commented-out, then you # probably should define those extensions to indicate media types: # addtype application/x-compress .z addtype application/x-gzip .gz .tgz addtype application/x-httpd-php .php addtype application/x-httpd-php .php3 # # addhandler allows you to map certain file extensions to handlers: # actions unrelated to filetype. these can be either built into the server # or added with the action directive (see below) # # to use cgi scripts outside of scriptaliased directories: # (you will also need to add execcgi to the options directive.) # #addhandler cgi-script .cgi # for type maps (negotiated resources): #addhandler type-map var # # filters allow you to process content before it is sent to the client. # # to parse .shtml files for server-side includes (ssi): # (you will also need to add includes to the options directive.) # #addtype text/html .shtml #addoutputfilter includes .shtml
htdocs本来就是放静态文件的
动态文件,例如php放cgi-bin里
google关键字:apache scriptalias
和什么目录没关系吧
我在里面创建的项目不能解析php文件.会提示连接被重置!或网络已断开.在地址栏输入这个路径只能看到当前目录下的文件.
而根目录的index.php却能正常解析.
如果没有index.php索引文件,你直接打开目录的话 的确是显示文件目录结构的,如果有这个index.php文档,那么apache会先解析index.php文档.这个你可以在apache的配置文件修改
搜索
options indexes followsymlinks
将indexes 去掉 保存重启apache 即可.
访问某个文件提示 连接被重置
那就查日志看看具体的错误是什么内容 .这种原因可能有很多,比如你的php出现错误 .打开 php.ini里的错误提示,设置浏览器的(ie的友好错误提示)...
多谢各位的解答.虽然一直没找出原因,但是也学了不少东西.
后来解决了.
解决方法很简单.我又重新下载了一个apache. 安装配置后,一切正常了.
我也遇到了这问题