2014-05-22 17 views
0

我在WINDOWS上成功安裝了Apache,並且可以打開一個HTML文件的問題。我也在服務器上安裝了PHP。我配置Apache和PHP爲每followng教程: http://www.sitepoint.com/how-to-install-apache-on-windows/ http://www.sitepoint.com/how-to-install-php-on-windows/爲PHP配置httpd.conf(您無權訪問此服務器上的/php/php-cgi.exe/index.php。)

如前所述阿帕奇可以讓我在我的網站打開HTML文件。添加一個PHP文件時,我得到錯誤: You don't have permission to access /php/php-cgi.exe/index.php on this server.

PHP安裝在c:\ PHP和在C apached:\ apache24

我已經嘗試了幾個選項來修復https.conf文件,但沒有任何成功。

我的配置文件片斷如下:

<Directory "c:/WebPages"> 
    # 
    # Possible values for the Options directive are "None", "All", 
    # or any combination of: 
    # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews 
    # 
    # Note that "MultiViews" must be named *explicitly* --- "Options All" 
    # doesn't give it to you. 
    # 
    # The Options directive is both complicated and important. Please see 
    # http://httpd.apache.org/docs/2.4/mod/core.html#options 
    # for more information. 
    # 
    ##Options Indexes FollowSymLinks 

    # 
    # AllowOverride controls what directives may be placed in .htaccess files. 
    # It can be "All", "None", or any combination of the keywords: 
    # AllowOverride FileInfo AuthConfig Limit 
    # 
    ##AllowOverride None 

    # 
    # Controls who can get stuff from this server. 
    # 
    ##Require all granted 

    #Options FollowSymLinks 
    AllowOverride None 
Options None 
Require all granted 
Allow from all 



</Directory> 

這樣我就可以查看HTML文件,但不是PHP所以上午thinkign我需要讓權限到C:\ PHP文件夾,但不知道是什麼?

任何意見歡迎。一如既往地感謝。

+0

爲什麼要自己安裝所有的東西,當你只需要安裝一個WAMP類型的包併爲你完成所有的工作,包括爲你設置適當的文件系統權限? –

+0

嗨馬克,WAMP不是用於開發環境,不建議用於生產服務器? – Smudger

+0

wamp只是預包裝(W)indows版本的(A)pache,(M)ysql和(P)HP。他們即將生產就像任何其他自己安裝的相同應用程序一樣。 –

回答

2

發生這種情況是因爲您的CGI文件夾不在您的PHP安裝文件夾中。嘗試將這些代碼行添加到您的httpd.conf文件中:

<Directory "c:/php"> 
    AllowOverride None 
    Options None 
    Require all granted 
</Directory> 

如果您沒有在c:\ php安裝PHP,請將其更改爲安裝它的位置。請記住,使用正斜槓而不是後斜槓(我總是混淆了這一點;我想大量的Linux操作)。

相關問題