ID:               25194
 User updated by:  ri at kamp dot de
 Reported By:      ri at kamp dot de
-Status:           Feedback
+Status:           Open
 Bug Type:         Filesystem function related
 Operating System: Solaris 8
 PHP Version:      4CVS-2003-08-21 (stable)
 New Comment:

The output of /bin/pwd is correct if executed from the shell (even as
user nobody). Also leaving out "." from include_path does not solve the
problem but behaves different:
1.)
ini_set("include_path","/usr/local/lib/php");
require("somefile.php");
works but it should not (or am I wrong?)
2.)
ini_set("include_path","/usr/local/lib/php");
require("./somefile.php");
does not work even if its nearly the same

also other commands (e.g. show_source) have problems.

I can send you a link in private mail if you like to see the results

Maybe its a solaris or apache bug but it seems to hit only php, so
there may be reasons to solve the problem (if not a bug) in php.


Previous Comments:
------------------------------------------------------------------------

[2003-08-22 02:27:38] [EMAIL PROTECTED]

What is the output of '/bin/pwd' when you run it in shell,
in the directory in question? 

(my guess it is wrong too, in which case this really is not any PHP bug
but yet another Solaris bug)

Also, if leaving "." out of the include_path solves this, I don't see
any reason why we should worry about this too much.


------------------------------------------------------------------------

[2003-08-22 00:04:42] ri at kamp dot de

Yes it seems to be nfs related since includes on a local disk
(phpmyadmin) work well.

------------------------------------------------------------------------

[2003-08-21 19:04:01] [EMAIL PROTECTED]

Works fine under Linux..but I don't have any NFS mount to work with.
Can you check if this happens only with the NFS?


------------------------------------------------------------------------

[2003-08-21 11:00:31] ri at kamp dot de

Description:
------------
require cannot open a file in the same directory as the calling script
[like require('./includefile.php')]. All dirs in the path have
permission 755. OS is solaris 8, documentroot mounted as NFS,
include_path has "." within. In the case this happens also getcwd() or
passthru("/bin/pwd") gives no result but passthru("/bin/ls") list the
"current" dir.

The function expand_filepath in main/fopen_wrappers.c gets an empty
result when calling VCWD_GETCWD(cwd, MAXPATHLEN);

This may not be a php bug (maybe solaris8 or nfs) but occurs only
within php. As workaround I changed expand_filepath to:
------------------
        int cwd_pos;

        result = VCWD_GETCWD(cwd, MAXPATHLEN);  
        if (!result) {
                //cwd[0] = '\0';
                php_error_docref(NULL TSRMLS_CC, E_WARNING, 
                        "cwd not working for
%s",SG(request_info).path_translated);
                strlcpy(cwd, SG(request_info).path_translated,
sizeof(cwd));
                cwd_pos = strlen(cwd) - 1;

                /* Strip filename */
                while (!IS_SLASH(cwd[cwd_pos])
                                && (cwd_pos >= 0)) {
                        cwd[cwd_pos--] = 0;
                }
        }
------------------

I know this is no final solution but the scripts work thereafter. 

Reproduce code:
---------------
include_path = ".:/usr/local/lib/php"
documentroot = "/home/htdocs"
script is in /home/htdocs/ (documentroot)

<? require('./somefile.php'; ?>

or

<? require('somefile.php'; ?>

Actual result:
--------------
Fatal error: main(): Failed opening required './somefile.php'
(include_path='.:/usr/local/lib/php')


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=25194&edit=1

Reply via email to