I've just installed a new Apache 2.4.2 with Php fast cgi build on windows.
Then I modified the httpd.conf adding the following:
LoadModule fcgid_module modules/mod_fcgid.so
FcgidInitialEnv PHPRC "C:/SITE/PHP"
AddHandler fcgid-script .php
FcgidWrapper "C:/SITE/PHP/php-cgi.exe" .php
DocumentRoot "C:/SITE/localhost/www"
<Directory "C:/SITE/localhost/www">
Order allow,deny
Allow from all
</Directory>
However when I try to open my site, it says:
Forbidden You don't have permission to access / on this server.
Any ideas what might be the problem?
Right-click the file or folder, and then click Properties. Click the Security tab. Under Group or user names, click your name to see the permissions that you have. Click Edit, click your name, select the check boxes for the permissions that you must have, and then click OK.
To fix the permission denied error in Linux, one needs to change the file permission of the script. Use the “chmod” (change mode) command for this purpose.
This was the correct way to do it: (thanks to DaveRandom)
<Directory "C:/SITE/localhost/www">
Options ExecCGI
AllowOverride all
Require all granted
</Directory>
Dave Random explains further:
After a little experimentation with this, I have discovered the nuance that makes this the correct answer, which is specific to Apache 2.3+. It seems that
mod_authz_host
directives take precedence overmod_access_compat
directives, and this bubbles all the way up the directory tree. What this means is that if you are migrating from Apache 2.2 to Apache 2.4 and you use your 2.2httpd.conf
verbatim, it will work.If, however, you perform a new install of 2.4 and base your config on the default 2.4
httpd.conf
,Allow
directives won't work, because the default top level section uses aRequire all denied
directive instead ofDeny from all
, and this takes precedence over any subsequentAllow
directives higher up the tree. The long of the short of this is that if you are migrating your Order/Allow/Deny directives to their equivalent Requires, then you must chance all of them or you will find you get 403s you weren't expecting.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With