Discussion:
trying to view php files locally Win7 Apache 2.4 PHP 7, httpd.conf alias question.
(too old to reply)
Mike S
2016-12-20 08:33:26 UTC
Permalink
# Under Win 7 Ultimate I installed Apache 2.4 and PHP 7
# I'd like to view PHP files locally using an alias.
# I added these lines to httpd.conf

AddHandler application/x-httpd-php .php
AddType application/x-httpd-php .html .htm
LoadModule php7_module "C:/php/php7apache2_4.dll"
PHPIniDir "C:/php"

Alias "/cc" "C:/My Webs/clutchcourier"

<Directory "C:/My Webs/clutchcourier">
Options Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
--------------
# These lines were left with default values

ServerRoot "c:/Apache24"

Listen 80

DocumentRoot "c:/Apache24/htdocs"
<Directory "c:/Apache24/htdocs">
...
--------------
# when I try to view a file "c:\my webs\clutchcourier\courier.php"
# by entering this into a browser "http://localhost/cc/courier.php"
# (using the alias created in httpd.conf) I see this in the browser

Forbidden

You don't have permission to access /cc/courier.php on this server.
--------------
In C:\Apache24\logs\error.log I see this error

[Tue Dec 20 00:29:13.033280 2016] [authz_core:error] [pid 3316:tid 964]
[client ::1:51618] AH01630: client denied by server configuration: C:/My
Webs/clutchcourier/courier.php
--------------

I have Taken Ownership of the "c:\my webs\clutchcourier" folder in
Windows, but I don't know how to tell Apache I have access to that
folder, if that is what is needed.

What am I missing?

TIA,
Mike
Mike S
2016-12-20 08:46:56 UTC
Permalink
Post by Mike S
# Under Win 7 Ultimate I installed Apache 2.4 and PHP 7
# I'd like to view PHP files locally using an alias.
# I added these lines to httpd.conf
AddHandler application/x-httpd-php .php
AddType application/x-httpd-php .html .htm
LoadModule php7_module "C:/php/php7apache2_4.dll"
PHPIniDir "C:/php"
Alias "/cc" "C:/My Webs/clutchcourier"
<Directory "C:/My Webs/clutchcourier">
Options Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
--------------
# These lines were left with default values
ServerRoot "c:/Apache24"
Listen 80
DocumentRoot "c:/Apache24/htdocs"
<Directory "c:/Apache24/htdocs">
...
--------------
# when I try to view a file "c:\my webs\clutchcourier\courier.php"
# by entering this into a browser "http://localhost/cc/courier.php"
# (using the alias created in httpd.conf) I see this in the browser
Forbidden
You don't have permission to access /cc/courier.php on this server.
--------------
In C:\Apache24\logs\error.log I see this error
[Tue Dec 20 00:29:13.033280 2016] [authz_core:error] [pid 3316:tid 964]
[client ::1:51618] AH01630: client denied by server configuration: C:/My
Webs/clutchcourier/courier.php
--------------
I have Taken Ownership of the "c:\my webs\clutchcourier" folder in
Windows, but I don't know how to tell Apache I have access to that
folder, if that is what is needed.
What am I missing?
TIA,
Mike
I changed this in httpd.conf and now I see a page rendering:

<Directory />
AllowOverride none
# Require all denied
Require all granted
</Directory>

http://httpd.apache.org/docs/2.4/upgrading.html#access

Loading...