環境是
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. 安裝配置後,一切正常了.
我也遇到了這問題