Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #6147

Re: is_dir true from cli, false from Apache

Message-ID <1902289.yOyI7JJenI@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2012-05-23 22:39 +0200
Subject Re: is_dir true from cli, false from Apache
Newsgroups comp.lang.php
References <4fbd1439$0$6967$c3e8da3$9b4ff22a@news.astraweb.com> <jpj5mc$33d$1@dont-email.me> <4fbd1d46$0$10768$c3e8da3$dbd57e7@news.astraweb.com> <jpj8rs$ovn$1@dont-email.me> <pMidnT1HJLR7qiDSnZ2dnUVZ_oOdnZ2d@posted.localnet>
Followup-To comp.lang.php

Followups directed to: comp.lang.php

Show all headers | View raw


Robert Heller wrote:

>> On 5/23/2012 1:24 PM, Robert Grimm wrote:
>> > On 2012-05-23 17:10:31 +0000, Jerry Stuckle said:
>> >> On 5/23/2012 12:45 PM, Robert Grimm wrote:
>> >>> I'm having trouble on CentOS 6 with PHP5. This is my test code:
>> >>>
>> >>> $dir = is_dir("/var/www/document_repository");
>> >>>
>> >>> Ultimately, I'm trying to get OpenDocMan working. That this test code
>> >>> fails shows why I can't get OpenDocMan working. I've tried everything
>> >>> I can think of. I've added a trailing /. I've put the directory in
>> >>> and out of the OpenDocMan directory, which has a directory definition
>> >>> in the Apache config. The user apache owns and has full access to the
>> >>> directory. I tested to make sure PHP was being run by apache with
>> >>> passthru("whoami");

What was not tried is to read and interpret the error message that this call 
prints (either in the browser or in the log file).  It should be something 
along the lines "open_basedir restriction in effect".

> […]
> There is also the possiblity that the apache (most likely) and/or php
> configuration might prevent a php web application from accessing disk
> space outside of under DOCUMENT_ROOT.  The base default DocumentRoot
> for a CentOS install of apache (httpd rpm) is /var/www/html and
> /var/www/document_repository is outside of that directory...  I am not
> sure if this is an apache or php configuration. 

It is a PHP configuration setting.

<http://php.net/open_basedir>

> I *suspect* that the default is to disallow a php program running under
> apache's PHP_MOD from accessing files, unless apache is allowing it.

Wrong.  Apache configuration files only come into play when HTTP is used 
from PHP, such as with fopen_url wrappers, like require('http://localhost/') 
– for whatever reason), but that is not the case here either.

> By default apache disallows access to the root file system (from
> httpd.conf):

Which PHP, as it is only executed in this case when Apache runs it, could 
not care less about, except when it contains `php_*' directives or includes 
files containing them:

<http://php.net/php_value>


PointedEars
-- 
Sometimes, what you learn is wrong. If those wrong ideas are close to the 
root of the knowledge tree you build on a particular subject, pruning the 
bad branches can sometimes cause the whole tree to collapse.
  -- Mike Duffy in cljs, <news:Xns9FB6521286DB8invalidcom@94.75.214.39>

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

is_dir true from cli, false from Apache Robert Grimm <robertgrimm@gmail.com> - 2012-05-23 12:45 -0400
  Re: is_dir true from cli, false from Apache Jerry Stuckle <jstucklex@attglobal.net> - 2012-05-23 13:10 -0400
    Re: is_dir true from cli, false from Apache Robert Grimm <robertgrimm@gmail.com> - 2012-05-23 13:24 -0400
      Re: is_dir true from cli, false from Apache Jerry Stuckle <jstucklex@attglobal.net> - 2012-05-23 14:04 -0400
        Re: is_dir true from cli, false from Apache Robert Heller <heller@deepsoft.com> - 2012-05-23 14:17 -0500
          Re: is_dir true from cli, false from Apache Jerry Stuckle <jstucklex@attglobal.net> - 2012-05-23 16:13 -0400
          Re: is_dir true from cli, false from Apache Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-05-23 22:39 +0200
          Re: is_dir true from cli, false from Apache Robert Grimm <robertgrimm@gmail.com> - 2012-05-23 16:44 -0400
            Re: is_dir true from cli, false from Apache Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-05-24 00:25 +0200
              Re: is_dir true from cli, false from Apache Robert Grimm <robertgrimm@gmail.com> - 2012-05-23 20:03 -0400
        Re: is_dir true from cli, false from Apache Robert Grimm <robertgrimm@gmail.com> - 2012-05-23 16:48 -0400
          Re: is_dir true from cli, false from Apache Robert Grimm <robertgrimm@gmail.com> - 2012-05-23 21:15 -0400
  Re: is_dir true from cli, false from Apache The Natural Philosopher <tnp@invalid.invalid> - 2012-05-23 19:55 +0100
    Re: is_dir true from cli, false from Apache Michael Fesser <netizen@gmx.de> - 2012-05-23 22:35 +0200

csiph-web