简体   繁体   English

为PHP配置httpd.conf(您无权访问此服务器上的/php/php-cgi.exe/index.php。)

[英]configure httpd.conf for PHP ( You don't have permission to access /php/php-cgi.exe/index.php on this server. )

I have installed Apache successfully on WINDOWS and can open an HTML file with no issues. 我已经在WINDOWS上成功安装了Apache,可以打开一个没有问题的HTML文件。 I also installed PHP on the server. 我还在服务器上安装了PHP。 I configured Apache and PHP as per the followng tutorials: http://www.sitepoint.com/how-to-install-apache-on-windows/ http://www.sitepoint.com/how-to-install-php-on-windows/ 我根据以下教程配置了Apache和PHP: http//www.sitepoint.com/how-to-install-apache-on-windows/ http://www.sitepoint.com/how-to-install-php -on窗口/

As mentioned apache allows me to open the html file in my website. 如上所述,apache允许我在我的网站中打开html文件。 when adding a php file I get error: You don't have permission to access /php/php-cgi.exe/index.php on this server. 添加php文件时出现错误: You don't have permission to access /php/php-cgi.exe/index.php on this server.

PHP is installed to c:\\PHP and apached in c:\\apache24 PHP安装到c:\\ PHP并在c:\\ apache24中缓存

I have tried a few options to fix the https.conf file but without any success. 我已经尝试了一些选项来修复https.conf文件,但没有任何成功。

My config file snippet is below: 我的配置文件片段如下:

<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>

This allows me to view the html file but not the php so am thinkign I need to allow permission to the c:\\PHP folder but have no idea what? 这允许我查看html文件而不是php,所以我想我需要允许c:\\ PHP文件夹的权限,但不知道是什么?

any advice welcome. 欢迎任何建议。 Thanks as always. 一如既往地谢谢。

This happens because your CGI folder isn't at your PHP install folder. 发生这种情况是因为您的CGI文件夹不在您的PHP安装文件夹中。 Try adding these lines of code to your httpd.conf file: 尝试将这些代码行添加到httpd.conf文件中:

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

If you didn't install PHP at c:\\php, change that to wherever you installed it. 如果您没有在c:\\ php上安装PHP,请将其更改为安装它的位置。 Remember, use forward slashes instead of back ones (I always get mixed up with that; to much Linuxing I guess). 请记住,使用正斜杠而不是反斜杠(我总是与之混淆;我认为很多Linux)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM