You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Ken Morley <Ke...@jmtg.com> on 2007/04/09 22:33:48 UTC
[users@httpd] What controls which directories httpd can serve from?
I'm running CentOS with Apache httpd V2.0.52-28 and php V4.3.9-3.22.3.
This may possibly be a PHP question, but I can't be sure. If I've got
the wrong forum, I apologize in advance.
On my web server, the document root is configured as /var/www/html. I
don't have any problem serving documents from there. There are also a
number of subdirectories like "admin", "panel", "recordings", etc.
These subdirectories contain some php scripts and other files.
I am testing some php sample applications. I created a subdirectory
called "samples" and moved the php files into ./samples to keep the
document root tidy. Once I did, the sample application stopped working
because httpd prohibits access.
The application is /var/www/html/samples/directory.php
When I run the app, here's what I see in /var/log/httpd/error_log:
[error] [client 192.168.168.41] (13)Permission denied: access to
/samples/directory.php denied.
If I move the file back to /var/www/html, it runs just fine. I
originally thought that it might have something to do with permissions,
but I've pretty much proven that's not the issue. I also made sure that
the file and it's subdirectory were owned by the user running httpd and
it made no difference.
I also thought that it might have something to do with httpd.conf.
Grep'ing httpd.conf doesn't show any entries for the other PHP
applications that work correctlty in ./admin, ./panel, etc. So I don't
think that it either.
Is there something that limits what directories httpd will serve or
where PHP applications can reside?
Thanks!
Ken
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
RE: [users@httpd] What controls which directories httpd can serve from?
Posted by Ken Morley <Ke...@jmtg.com>.
>>On 4/9/07, Ken Morley <Ke...@jmtg.com> wrote:
>> When I run the app, here's what I see in /var/log/httpd/error_log:
>>
>> [error] [client 192.168.168.41] (13)Permission denied: access to
>> /samples/directory.php denied.
>>
>> If I move the file back to /var/www/html, it runs just fine. I
>> originally thought that it might have something to do with
>> permissions, but I've pretty much proven that's not the issue. I
also
>> made sure that the file and it's subdirectory were owned by the user
>> running httpd and it made no difference.
> On 4/9/07, Joshua wrote:
>
>This error log message occurs only when apache does not have the unix
permissions necessary to access the file >in the filesystem. Check the
permissions of the samples directory to make sure it is searchable
(chmod +x).
>Also check to see if you are using anything fancy like symlinks or
SELinux.
>
>Joshua.
On 4/9/07, Ken Morley wrote:
Joshua:
Thanks VERY MUCH for the reply. I tried your suggestion of making the
./samples directory executable and that solves the problem! BTW, I'm not
using SELinux or symlinks.
The question remains as to why the ./samples directory requires +x and
the others don't. They are identically owned with identical permissions
on the directory and files. The directories created by the FreePBX
installation run PHP programs just fine, while the directory I created
by hand requires the chmod +x. Go figure...
Here's the contents of /var/www/html. Note that admin, panel,
recordings applications all work fine without chmod +x.
drw-rw---- 7 asterisk asterisk 4096 Apr 9 17:21 admin
drw-r--r-- 5 root root 4096 Feb 3 16:24 asteridex
drw-r----- 2 asterisk asterisk 4096 Nov 27 10:16 _asterisk
-rw-r--r-- 1 root root 602 Jan 25 08:25 index.html
lrwxrwxrwx 1 root root 14 Nov 28 09:34 linux-docs ->
/usr/share/doc
-rw-r--r-- 1 root root 4542 Jan 25 08:25 mainstyle.css
-rw-r--r-- 1 root root 4120 Apr 2 19:20 mc.cgi
drw-rw---- 2 asterisk asterisk 4096 Jan 25 16:04 panel
drw-rw-rw- 2 root root 4096 Apr 9 13:30 phpagi
drw-r--r-- 10 root root 4096 Jan 30 16:02 phpMyAdmin
drw-rw---- 7 asterisk asterisk 4096 Nov 27 10:16 recordings
drwxrwx--x 2 asterisk asterisk 4096 Apr 9 14:32 samples
-rw-r--r-- 1 root root 1323 Apr 3 08:25 test.cgi
drw-r--r-- 2 root root 4096 Apr 3 07:32 xml
Contents of /var/www/html/admin. Note that all PHP files are owned by
asterisk:asterisk
and have 664 permissions:
-rwxrwxr-- 1 asterisk asterisk 40 Jan 25 08:25 bounce_op.sh
drwxrwx--- 6 asterisk asterisk 4096 Nov 27 10:16 cdr
drwxrwx--- 2 asterisk asterisk 4096 Nov 27 10:16 common
-rw-rw-r-- 1 asterisk asterisk 20979 Jan 25 08:25 components.class.php
-rw-rw-r-- 1 asterisk asterisk 13993 Jan 25 08:25 config.php
-rw-rw-r-- 1 asterisk asterisk 20908 Jan 25 08:25 extensions.class.php
-rw-rw-r-- 1 asterisk asterisk 7404 Jan 25 08:25
featurecodes.class.php
-rw-rw-r-- 1 asterisk asterisk 5116 Jan 25 08:25 footer.php
-rw-rw-r-- 1 asterisk asterisk 73827 Jan 25 08:25 functions.inc.php
-rw-rw-r-- 1 asterisk asterisk 3808 Jan 25 08:25 header_auth.php
-rw-rw-r-- 1 asterisk asterisk 7459 Jan 25 08:25 header.php
drwxrwx--- 9 asterisk asterisk 4096 Nov 27 10:16 i18n
drwxrwx--- 2 asterisk asterisk 4096 Nov 27 10:16 images
-rw-rw-r-- 1 asterisk asterisk 1524 Jan 25 08:25 index.php
-rw-rw-r-- 1 asterisk asterisk 1700 Jan 25 08:25 logout.php
drwxrwx--- 45 asterisk asterisk 4096 Mar 23 08:47 modules
-rw-rw-r-- 1 asterisk asterisk 26634 Jan 25 08:25 page.modules.php
-rw-rw-r-- 1 asterisk asterisk 1099 Jan 25 08:25 panel.php
-rw-rw-r-- 1 asterisk asterisk 2608 Jan 25 08:25 reports.php
-rw-rw-r-- 1 asterisk asterisk 5 Jan 25 08:25 version.txt
Contents of /var/www/html/samples. Note that all PHP files are owned by
asterisk:asterisk
and have 664 permissions:
-rw-rw-r-- 1 asterisk asterisk 5192 Apr 9 14:03 cfwd.php
-rw-rw-r-- 1 asterisk asterisk 4196 Apr 9 10:51 directory.php
-rw-rw-r-- 1 asterisk asterisk 4174 Apr 8 12:13 dnd.php
-rw-rw-r-- 1 asterisk asterisk 1524 Apr 9 14:32 index.php
-rw-rw-r-- 1 asterisk asterisk 663 Apr 9 14:01 meetme-user-room.php
-rw-rw-r-- 1 asterisk asterisk 375 Apr 9 14:01 misc.php
-rw-rw-r-- 1 asterisk asterisk 19627 Apr 9 14:01 phpagi-asmanager.php
-rw-rw-r-- 1 asterisk asterisk 622 Apr 9 14:01 phpagi.example.conf
-rw-rw-r-- 1 asterisk asterisk 47179 Apr 9 14:01 phpagi.php
-rw-rw-r-- 1 asterisk asterisk 6228 Apr 9 14:01
README.phpagi-asmanager
-rw-rw-r-- 1 asterisk asterisk 1167 Apr 8 12:13 register.php
-rw-rw-r-- 1 asterisk asterisk 9532 Apr 8 11:44 sample.php
I wonder what the difference is?
Thanks again!
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] What controls which directories httpd can serve from?
Posted by Joshua Slive <jo...@slive.ca>.
On 4/9/07, Ken Morley <Ke...@jmtg.com> wrote:
> When I run the app, here's what I see in /var/log/httpd/error_log:
>
> [error] [client 192.168.168.41] (13)Permission denied: access to
> /samples/directory.php denied.
>
> If I move the file back to /var/www/html, it runs just fine. I
> originally thought that it might have something to do with permissions,
> but I've pretty much proven that's not the issue. I also made sure that
> the file and it's subdirectory were owned by the user running httpd and
> it made no difference.
This error log message occurs only when apache does not have the unix
permissions necessary to access the file in the filesystem. Check the
permissions of the samples directory to make sure it is searchable
(chmod +x). Also check to see if you are using anything fancy like
symlinks or SELinux.
Joshua.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org