Re: safe_mode and inclusion of files don't work as documented
| From: | hack988 hack988 | Date: | Mon, 31 Aug 2009 20:56:21 +0000 |
| Subject: | Re: safe_mode and inclusion of files don't work as documented | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-297521@lists.php.net to get a copy of this message | ||
Please create a file(.php) and write follow codes for more details.
============================
<?php
phpinfo();
?>
============================
2009/8/31 Nico Sabbi <nsabbi@officinedigitali.it>:
> Lars Torben Wilson ha scritto:
>> 2009/8/28 Nico Sabbi <nsabbi@officinedigitali.it>:
>>
>>> Hi,
>>> I'm testing one of my sites in safe_mode, but I'm experiencing some
>>> strangeness that is not documented.
>>>
>>> The settings are:
>>> in php.ini:
>>> include_path =
>>>
>>> ".:/server/home/apache/php4/:/var/php/5.2/pear/:/usr/php/lib/ezcomponents-2008.2.2/"
>>>
>>> in the virtualhost config:
>>> php_admin_value safe_mode On
>>> php_admin_value safe_mode_include_dir
>>> "/server/home/nsabbi:/server/home/apache/php4:.:.."
>>>
>>> The files belong entirely to apache:apache, the user who is running apache.
>>> The problem is:
>>>
>>>
>>> *Fatal error*: require_once() [function.require
>>> <http://nsabbi/login/function.require>]: Failed
>>> opening required
>>> '../include.php'
>>>
>>> (include_path='.:..:/server/home/apache/php4/:/var/php/5.2/pear/:/usr/php/lib/ezcomponents-2008.2.2/')
>>> in */server/home/nsabbi/nb4/login/index.php* on line *3
>>>
>>> How is it that i can't include files in .. ????
>>>
>>
>> Hi Nico,
>>
>> First the obligatory "safe_mode is deprecated and not recommended"
>> speech. . .but I guess you've already seen that in the docs and
>> decided to use it anyway.
>>
>> What does the script do if you turn off safe_mode?
>>
>>
>>> btw, can I redefine the include_path in safe mode?
>>>
>>
>> Yes.
>>
>>
>>> Thanks,
>>> Nico
>>>
>>
>>
>> Regards,
>>
>> Torben
>>
>
> one more clue, hopefully; the OS is OpenSolaris.
>
> apache@sviluppo2: /server/home/nsabbi/nb4 $ ps -ef|grep httpd
> apache 26840 25190 0 12:54:05 ? 0:09
> /usr/apache2/2.2/bin/httpd -k start
> apache 26842 25190 0 12:58:09 ? 0:21
> /usr/apache2/2.2/bin/httpd -k start
> root 25190 1 0 Aug 28 ? 2:27
> /usr/apache2/2.2/bin/httpd -k start
> apache 25191 25190 0 Aug 28 ? 0:00
> /usr/apache2/2.2/bin/httpd -k start
> apache 26844 25190 0 13:00:54 ? 0:21
> /usr/apache2/2.2/bin/httpd -k start
> apache 26864 25190 0 13:05:37 ? 0:01
> /usr/apache2/2.2/bin/httpd -k start
> apache 26890 26872 0 13:11:25 pts/1 0:00 grep httpd
> apache 26865 25190 0 13:07:24 ? 0:01
> /usr/apache2/2.2/bin/httpd -k start
> apache 26821 25190 0 12:51:08 ? 0:24
> /usr/apache2/2.2/bin/httpd -k start
> apache 26845 25190 0 13:01:44 ? 0:02
> /usr/apache2/2.2/bin/httpd -k start
> apache 26789 25190 0 12:37:25 ? 0:27
> /usr/apache2/2.2/bin/httpd -k start
> apache 26863 25190 0 13:04:18 ? 0:01
> /usr/apache2/2.2/bin/httpd -k start
> apache 26846 25190 0 13:01:45 ? 0:11
> /usr/apache2/2.2/bin/httpd -k start
>
>
> *Warning*: require_once() [function.require-once
> <http://nsabbi/login/function.require-once>]: SAFE MODE
> Restriction in
> effect. The script whose uid is 1 is not allowed to access
> ../include.php owned by uid 48 in
> */server/home/nsabbi/nb4/login/index.php* on line *3*
>
> *Warning*: require_once(../include.php) [function.require-once
> <http://nsabbi/login/function.require-once>]: failed to
> open stream: No
> such file or directory in */server/home/nsabbi/nb4/login/index.php* on
> line *3*
>
> *Fatal error*: require_once() [function.require
> <http://nsabbi/login/function.require>]: Failed opening
> required
> '../include.php'
> (include_path='.:/server/home/apache/php4/:/var/php/5.2/pear/') in
> */server/home/nsabbi/nb4/login/index.php* on line *3*
>
>
>
> why is php using uid 1?? It's as if the parent httpd were serving the
> page itself, or not?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>