Date: 09/16/00
- Next message: Bug Database: "[PHP-DEV] PHP 4.0 Bug #6663 Updated: mktime returns -1 whereas 4.0.1pl2 returned the correct value"
- Previous message: Andi Gutmans: "Re: [PHP-DEV] doc_root problem"
- Next in thread: Andi Gutmans: "Re: [PHP-DEV] doc_root problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
OK I see what the problem is now.
The Apache module doesn't use php_fopen_primary_script(). This is only
meant for CGI mode. It uses php_fopen_with_path() where doc_root is always
prepended to the filename and in the main scripts case, it is prepended to
PATH_TRANSLATED which causes your problems.
For some reason this worked with PHP 3 but doesn't work with PHP 4 (it
worked with earlier versions of PHP 4 because the code had a bug).
As we've always said, safe_mode really doesn't seem too be very safe. And
this is the case. I could fix the current few lines in
php_fopen_with_path() which checks if the filename is an absolute filename
and if it is prepends doc_root. I could check instead if that file starts
with doc_root and if it does not prepend doc_root. This is however a
temporary hack and doesn't really solve the problem, i.e., doc_root doesn't
really work throughout the fopen_with_path() functions.
I'm not quite sure what to do in this case because any quick fix I can
think of is not a real fix.
Andi
At 07:53 AM 9/15/00 -0400, Patrick Aland wrote:
>Setup:
>RH 6.2, PHP4.0.2 with support for pgsql/pdflib, Apache 1.3.12
>safe_mode = On
>doc_root = /usr/local/apache/httpd
>
>test.php:
><?
>phpinfo();
>?>
>
>Output of viewing test.php:
>
>Warning: Unable to access
>/usr/local/apache/httpd/usr/local/apache/httpd/htdocs/test.php in Unknown
>on line 0
>
>Warning: Failed opening '/usr/local/apache/httpd/htdocs/test.php' for
>inclusion (include_path='.:/usr/local/lib/php') in Unknown on
>line 0
>
>At what point in MY code do I have an error?
>Thanks.
>
>--patrick
>
>
>On Fri, Sep 15, 2000 at 12:13:38AM -0400, Comeau, Michel wrote:
> > I'd say, keep the fixed one ... and users should fix their PHP code.
> Fix the
> > doc too (if needed).
> >
> > -----Original Message-----
> > From: Andi Gutmans [mailto:andi <email protected>]
> > Sent: Thursday, September 14, 2000 4:55 PM
> > To: PHP Development
> > Subject: [PHP-DEV] doc_root problem
> >
> >
> > A lot of users have posted problems with doc_root & safe_mode. This is
> > between PHP 4.0.1pl2 and 4.0.2.
> > I fixed a bug in fopen-wrappers.c line 416 in this time period where
> > filename was being used instead of trypath (an obvious mistake because why
> > did the author bother to setup trypath 3 lines before with the snprintf()).
> > So what was happening was that when doc_root was set it wasn't really being
> > appended in php_fopen_with_path but only in php_fopen_primary_script.
> > Now it seems that the problem is something like this:
> > doc_root is set to /foo/bar
> > they include "/foo/bar/blah.inc"
> > and then they get /foo/bar/foo/bar/blah.inc.
> > From what I understand (both from the manual and from the code which was
> > written in PHP 3's fopen-wrapper) that the current behavior after my fix is
> > the correct one.
> >
> > Does anyone think differently? How should we address this issue?
> >
> > Andi
> > ---
> > Andi Gutmans <andi <email protected>>
> > http://www.zend.com/
> >
> > --
> > PHP Development Mailing List <http://www.php.net/>
> > To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
> > For additional commands, e-mail: php-dev-help <email protected>
> > To contact the list administrators, e-mail: php-list-admin <email protected>
> >
> >
> > --
> > PHP Development Mailing List <http://www.php.net/>
> > To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
> > For additional commands, e-mail: php-dev-help <email protected>
> > To contact the list administrators, e-mail: php-list-admin <email protected>
>
>--
>PHP Development Mailing List <http://www.php.net/>
>To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
>For additional commands, e-mail: php-dev-help <email protected>
>To contact the list administrators, e-mail: php-list-admin <email protected>
--- Andi Gutmans <andi <email protected>> http://www.zend.com/-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Bug Database: "[PHP-DEV] PHP 4.0 Bug #6663 Updated: mktime returns -1 whereas 4.0.1pl2 returned the correct value"
- Previous message: Andi Gutmans: "Re: [PHP-DEV] doc_root problem"
- Next in thread: Andi Gutmans: "Re: [PHP-DEV] doc_root problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

