#39351 [NEW]: require and include fails to open file in current directory

Ask a Question related to PHP Bugs, Design and Development.

  1. #1

    Default #39351 [NEW]: require and include fails to open file in current directory

    From: lampiluoto at gmail dot com
    Operating system: Solaris10
    PHP version: 5.2.0
    PHP Bug Type: *Directory/Filesystem functions
    Bug description: require and include fails to open file in current directory

    Description:
    ------------
    I upgraded to PHP 5.2.0 on Solaris 10 (amd64). Executing PHP code failed
    and produced errors as any require() or include() with relative path
    fails. With absolute path it's ok.

    The same code in same environment works fine on PHP 5.1.6.

    Reason might be that on Solaris getcwd() does not return current working
    directory unless user has read privileges from root directory to the
    current dir. Has something changed in 5.2.0 ?

    User running httpd does not have read privileges to every directory in
    Apache HTTPd's DocumentRoot path - it has only execute (x) privilege to
    part of the directories.


    Reproduce code:
    ---------------
    // this fails on 5.2.0 but works fine on 5.1.6
    require('config.php');

    // this works also on 5.2.0
    require('/absolute/path/to/config.php');

    Expected result:
    ----------------
    File config.inc should be read successfully. This require('config.php')
    works fine on PHP 5.1.6 but after upgrading to 5.2.0 on same environment,
    it does not.

    Actual result:
    --------------
    // with relative path
    [Fri Nov 03 00:13:15 2006] [error] [client x.x.x.x] PHP Warning:
    require(config.php) [<a href='function.require'>function.require</a>]:
    failed to open stream: No such file or directory in /path/to/index.php on
    line 3, referer: [url]http://mysite/index.php[/url]

    [Fri Nov 03 00:13:15 2006] [error] [client x.x.x.x] PHP Fatal error:
    require() [<a href='function.require'>function.require</a>]: Failed
    opening required 'config.php' (include_path='.:/opt/httpd/php5/lib/php')
    in /path/to/index.php on line 3, referer: [url]http://mysite/index.php[/url]


    --
    Edit bug report at [url]http://bugs.php.net/?id=39351&edit=1[/url]
    --
    Try a CVS snapshot (PHP 4.4): [url]http://bugs.php.net/fix.php?id=39351&r=trysnapshot44[/url]
    Try a CVS snapshot (PHP 5.2): [url]http://bugs.php.net/fix.php?id=39351&r=trysnapshot52[/url]
    Try a CVS snapshot (PHP 6.0): [url]http://bugs.php.net/fix.php?id=39351&r=trysnapshot60[/url]
    Fixed in CVS: [url]http://bugs.php.net/fix.php?id=39351&r=fixedcvs[/url]
    Fixed in release: [url]http://bugs.php.net/fix.php?id=39351&r=alreadyfixed[/url]
    Need backtrace: [url]http://bugs.php.net/fix.php?id=39351&r=needtrace[/url]
    Need Reproduce Script: [url]http://bugs.php.net/fix.php?id=39351&r=needscript[/url]
    Try newer version: [url]http://bugs.php.net/fix.php?id=39351&r=oldversion[/url]
    Not developer issue: [url]http://bugs.php.net/fix.php?id=39351&r=support[/url]
    Expected behavior: [url]http://bugs.php.net/fix.php?id=39351&r=notwrong[/url]
    Not enough info: [url]http://bugs.php.net/fix.php?id=39351&r=notenoughinfo[/url]
    Submitted twice: [url]http://bugs.php.net/fix.php?id=39351&r=submittedtwice[/url]
    register_globals: [url]http://bugs.php.net/fix.php?id=39351&r=globals[/url]
    PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=39351&r=php3[/url]
    Daylight Savings: [url]http://bugs.php.net/fix.php?id=39351&r=dst[/url]
    IIS Stability: [url]http://bugs.php.net/fix.php?id=39351&r=isapi[/url]
    Install GNU Sed: [url]http://bugs.php.net/fix.php?id=39351&r=gnused[/url]
    Floating point limitations: [url]http://bugs.php.net/fix.php?id=39351&r=float[/url]
    No Zend Extensions: [url]http://bugs.php.net/fix.php?id=39351&r=nozend[/url]
    MySQL Configuration Error: [url]http://bugs.php.net/fix.php?id=39351&r=mysqlcfg[/url]
    lampiluoto at gmail dot com Guest

  2. Similar Questions and Discussions

    1. How to get the full path of the current open PDF file?
      How to get the full path of the current open PDF file from PDDOC or AVDOC?? Thanks!!
    2. File/Directory NOT Exists Test Fails
      Hi, I am migrating clients to a new server and Cont 3 is throwing this(See below) up during the connection and so the connection is failing. Does...
    3. PHP require or include and Contribute 3
      I'm disappointed that the <?php require('.. ); ?> or <?php include('.. ); ?> do not render in EDIT mode in Contribute 3. I tried a SSI shtml, and...
    4. How to open a file in the current directory
      Set fileSystem = Server.CreateObject( "Scripting.FileSystemObject" ) Set file = fileSystem.OpenTextFile( "config.xml", 1, False ) It's saying...
    5. The file 'bin\WebProj.dll' cannot be copied to the run directory. The requested operation cannot be performed on a file with a user-mapped section open.
      Hi, All, I got this error when trying to compile a web project. The file 'bin\Kennel.dll' cannot be copied to the run directory. The requested...
  3. #2

    Default #39351 [Opn->Fbk]: require and include fails to open file in current directory

    ID: 39351
    Updated by: [email]rasmus@php.net[/email]
    Reported By: lampiluoto at gmail dot com
    -Status: Open
    +Status: Feedback
    Bug Type: *Directory/Filesystem functions
    Operating System: Solaris10
    PHP Version: 5.2.0
    New Comment:

    Would it be possible for you to get us an strace or truss of a 5.1.6
    relative include and the same for a 5.2.0 one? I don't remember any
    getcwd() changes, but it sounds like there must have been one
    somewhere.


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

    [2006-11-02 22:38:02] lampiluoto at gmail dot com

    Description:
    ------------
    I upgraded to PHP 5.2.0 on Solaris 10 (amd64). Executing PHP code
    failed and produced errors as any require() or include() with relative
    path fails. With absolute path it's ok.

    The same code in same environment works fine on PHP 5.1.6.

    Reason might be that on Solaris getcwd() does not return current
    working directory unless user has read privileges from root directory
    to the current dir. Has something changed in 5.2.0 ?

    User running httpd does not have read privileges to every directory in
    Apache HTTPd's DocumentRoot path - it has only execute (x) privilege to
    part of the directories.


    Reproduce code:
    ---------------
    // this fails on 5.2.0 but works fine on 5.1.6
    require('config.php');

    // this works also on 5.2.0
    require('/absolute/path/to/config.php');

    Expected result:
    ----------------
    File config.inc should be read successfully. This require('config.php')
    works fine on PHP 5.1.6 but after upgrading to 5.2.0 on same
    environment, it does not.

    Actual result:
    --------------
    // with relative path
    [Fri Nov 03 00:13:15 2006] [error] [client x.x.x.x] PHP Warning:
    require(config.php) [<a href='function.require'>function.require</a>]:
    failed to open stream: No such file or directory in /path/to/index.php
    on line 3, referer: [url]http://mysite/index.php[/url]

    [Fri Nov 03 00:13:15 2006] [error] [client x.x.x.x] PHP Fatal error:
    require() [<a href='function.require'>function.require</a>]: Failed
    opening required 'config.php'
    (include_path='.:/opt/httpd/php5/lib/php') in /path/to/index.php on
    line 3, referer: [url]http://mysite/index.php[/url]



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


    --
    Edit this bug report at [url]http://bugs.php.net/?id=39351&edit=1[/url]
    rasmus@php.net Guest

  4. #3

    Default #39351 [Fbk->Opn]: require and include fails to open file in current directory

    ID: 39351
    User updated by: lampiluoto at gmail dot com
    Reported By: lampiluoto at gmail dot com
    -Status: Feedback
    +Status: Open
    Bug Type: *Directory/Filesystem functions
    Operating System: Solaris10
    PHP Version: 5.2.0
    New Comment:

    Here is part of the truss output, I can provide the whole output if
    needed. After failing getcwd() 5.2.0 tries to open file with wrong
    path.

    #
    # PHP-5.1.6
    #

    662: stat("./inc/config.php", 0xFFFFFD7FFFDFDEE0) = 0
    662: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    662: getcwd(0xFFFFFD7FFFDFD160, 1024) Err#13 EACCES
    [file_dac_read]
    662: stat("./inc/config.php", 0xFFFFFD7FFFDFDE00) = 0
    662: getcwd(0xFFFFFD7FFFDFDA10, 1024) Err#13 EACCES
    [file_dac_read]
    662: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    662: getcwd(0xFFFFFD7FFFDFCCE0, 1024) Err#13 EACCES
    [file_dac_read]
    662: open("./inc/config.php", O_RDONLY) = 17
    662: fstat(17, 0x00783920) = 0
    662: lseek(17, 0, SEEK_CUR) = 0
    662: read(17, " < ? p h p\n\n / / ".., 8192) = 1572
    662: read(17, 0x0077F258, 8192) = 0
    662: read(17, 0x0077F258, 8192) = 0
    662: close(17) = 0
    662: time() = 1163357246

    #
    # PHP-5.2.0
    #

    17703: stat("./inc/config.php", 0xFFFFFD7FFFDFDFB0) = 0
    17703: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    17703: getcwd(0xFFFFFD7FFFDFD230, 1024) Err#13 EACCES
    [file_dac_read]
    17703: stat("./inc/config.php", 0xFFFFFD7FFFDFDED0) = 0
    17703: getcwd(0xFFFFFD7FFFDFDAE0, 1024) Err#13 EACCES
    [file_dac_read]
    17703: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    17703: getcwd(0xFFFFFD7FFFDFCDE0, 1024) Err#13 EACCES
    [file_dac_read]
    17703: open("/inc/config.php", O_RDONLY) Err#2 ENOENT
    17703: open("/data/logs/httpd/error_log-php",
    O_WRONLY|O_APPEND|O_CREAT,0666) = 17
    17703: lseek(17, 0, SEEK_END) = 0
    17703: time() = 1163358385
    17703: fstat(17, 0xFFFFFD7FFFDFC880) = 0
    17703: fstat(17, 0xFFFFFD7FFFDFC7D0) = 0
    17703: ioctl(17, TCGETA, 0xFFFFFD7FFFDFC840) Err#25 ENOTTY
    17703: write(17, " [ 1 2 - N o v - 2 0 0 6".., 224) = 224
    17703: close(17) = 0


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

    [2006-11-11 22:57:10] [email]rasmus@php.net[/email]

    Would it be possible for you to get us an strace or truss of a 5.1.6
    relative include and the same for a 5.2.0 one? I don't remember any
    getcwd() changes, but it sounds like there must have been one
    somewhere.

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

    [2006-11-02 22:38:02] lampiluoto at gmail dot com

    Description:
    ------------
    I upgraded to PHP 5.2.0 on Solaris 10 (amd64). Executing PHP code
    failed and produced errors as any require() or include() with relative
    path fails. With absolute path it's ok.

    The same code in same environment works fine on PHP 5.1.6.

    Reason might be that on Solaris getcwd() does not return current
    working directory unless user has read privileges from root directory
    to the current dir. Has something changed in 5.2.0 ?

    User running httpd does not have read privileges to every directory in
    Apache HTTPd's DocumentRoot path - it has only execute (x) privilege to
    part of the directories.


    Reproduce code:
    ---------------
    // this fails on 5.2.0 but works fine on 5.1.6
    require('config.php');

    // this works also on 5.2.0
    require('/absolute/path/to/config.php');

    Expected result:
    ----------------
    File config.inc should be read successfully. This require('config.php')
    works fine on PHP 5.1.6 but after upgrading to 5.2.0 on same
    environment, it does not.

    Actual result:
    --------------
    // with relative path
    [Fri Nov 03 00:13:15 2006] [error] [client x.x.x.x] PHP Warning:
    require(config.php) [<a href='function.require'>function.require</a>]:
    failed to open stream: No such file or directory in /path/to/index.php
    on line 3, referer: [url]http://mysite/index.php[/url]

    [Fri Nov 03 00:13:15 2006] [error] [client x.x.x.x] PHP Fatal error:
    require() [<a href='function.require'>function.require</a>]: Failed
    opening required 'config.php'
    (include_path='.:/opt/httpd/php5/lib/php') in /path/to/index.php on
    line 3, referer: [url]http://mysite/index.php[/url]



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


    --
    Edit this bug report at [url]http://bugs.php.net/?id=39351&edit=1[/url]
    lampiluoto at gmail dot com Guest

  5. #4

    Default #39351 [Opn->Fbk]: require and include fails to open file in current directory

    ID: 39351
    Updated by: [email]tony2001@php.net[/email]
    Reported By: lampiluoto at gmail dot com
    -Status: Open
    +Status: Feedback
    Bug Type: *Directory/Filesystem functions
    Operating System: Solaris10
    PHP Version: 5.2.0
    New Comment:

    Please try using this CVS snapshot:

    [url]http://snaps.php.net/php5.2-latest.tar.gz[/url]

    For Windows:

    [url]http://snaps.php.net/win32/php5.2-win32-latest.zip[/url]




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

    [2006-11-12 19:17:43] lampiluoto at gmail dot com

    Here is part of the truss output, I can provide the whole output if
    needed. After failing getcwd() 5.2.0 tries to open file with wrong
    path.

    #
    # PHP-5.1.6
    #

    662: stat("./inc/config.php", 0xFFFFFD7FFFDFDEE0) = 0
    662: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    662: getcwd(0xFFFFFD7FFFDFD160, 1024) Err#13 EACCES
    [file_dac_read]
    662: stat("./inc/config.php", 0xFFFFFD7FFFDFDE00) = 0
    662: getcwd(0xFFFFFD7FFFDFDA10, 1024) Err#13 EACCES
    [file_dac_read]
    662: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    662: getcwd(0xFFFFFD7FFFDFCCE0, 1024) Err#13 EACCES
    [file_dac_read]
    662: open("./inc/config.php", O_RDONLY) = 17
    662: fstat(17, 0x00783920) = 0
    662: lseek(17, 0, SEEK_CUR) = 0
    662: read(17, " < ? p h p\n\n / / ".., 8192) = 1572
    662: read(17, 0x0077F258, 8192) = 0
    662: read(17, 0x0077F258, 8192) = 0
    662: close(17) = 0
    662: time() = 1163357246

    #
    # PHP-5.2.0
    #

    17703: stat("./inc/config.php", 0xFFFFFD7FFFDFDFB0) = 0
    17703: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    17703: getcwd(0xFFFFFD7FFFDFD230, 1024) Err#13 EACCES
    [file_dac_read]
    17703: stat("./inc/config.php", 0xFFFFFD7FFFDFDED0) = 0
    17703: getcwd(0xFFFFFD7FFFDFDAE0, 1024) Err#13 EACCES
    [file_dac_read]
    17703: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    17703: getcwd(0xFFFFFD7FFFDFCDE0, 1024) Err#13 EACCES
    [file_dac_read]
    17703: open("/inc/config.php", O_RDONLY) Err#2 ENOENT
    17703: open("/data/logs/httpd/error_log-php",
    O_WRONLY|O_APPEND|O_CREAT,0666) = 17
    17703: lseek(17, 0, SEEK_END) = 0
    17703: time() = 1163358385
    17703: fstat(17, 0xFFFFFD7FFFDFC880) = 0
    17703: fstat(17, 0xFFFFFD7FFFDFC7D0) = 0
    17703: ioctl(17, TCGETA, 0xFFFFFD7FFFDFC840) Err#25 ENOTTY
    17703: write(17, " [ 1 2 - N o v - 2 0 0 6".., 224) = 224
    17703: close(17) = 0

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

    [2006-11-11 22:57:10] [email]rasmus@php.net[/email]

    Would it be possible for you to get us an strace or truss of a 5.1.6
    relative include and the same for a 5.2.0 one? I don't remember any
    getcwd() changes, but it sounds like there must have been one
    somewhere.

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

    [2006-11-02 22:38:02] lampiluoto at gmail dot com

    Description:
    ------------
    I upgraded to PHP 5.2.0 on Solaris 10 (amd64). Executing PHP code
    failed and produced errors as any require() or include() with relative
    path fails. With absolute path it's ok.

    The same code in same environment works fine on PHP 5.1.6.

    Reason might be that on Solaris getcwd() does not return current
    working directory unless user has read privileges from root directory
    to the current dir. Has something changed in 5.2.0 ?

    User running httpd does not have read privileges to every directory in
    Apache HTTPd's DocumentRoot path - it has only execute (x) privilege to
    part of the directories.


    Reproduce code:
    ---------------
    // this fails on 5.2.0 but works fine on 5.1.6
    require('config.php');

    // this works also on 5.2.0
    require('/absolute/path/to/config.php');

    Expected result:
    ----------------
    File config.inc should be read successfully. This require('config.php')
    works fine on PHP 5.1.6 but after upgrading to 5.2.0 on same
    environment, it does not.

    Actual result:
    --------------
    // with relative path
    [Fri Nov 03 00:13:15 2006] [error] [client x.x.x.x] PHP Warning:
    require(config.php) [<a href='function.require'>function.require</a>]:
    failed to open stream: No such file or directory in /path/to/index.php
    on line 3, referer: [url]http://mysite/index.php[/url]

    [Fri Nov 03 00:13:15 2006] [error] [client x.x.x.x] PHP Fatal error:
    require() [<a href='function.require'>function.require</a>]: Failed
    opening required 'config.php'
    (include_path='.:/opt/httpd/php5/lib/php') in /path/to/index.php on
    line 3, referer: [url]http://mysite/index.php[/url]



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


    --
    Edit this bug report at [url]http://bugs.php.net/?id=39351&edit=1[/url]
    tony2001@php.net Guest

  6. #5

    Default #39351 [Fbk->Opn]: require and include fails to open file in current directory

    ID: 39351
    User updated by: lampiluoto at gmail dot com
    Reported By: lampiluoto at gmail dot com
    -Status: Feedback
    +Status: Open
    Bug Type: *Directory/Filesystem functions
    Operating System: Solaris10
    PHP Version: 5.2.0
    New Comment:

    Here's truss output with php5.2-200611151130.

    There seems to be changes for stat()'ing the
    file and though it fixes the first
    include('inc/config.php') it causes problems
    later on.

    Including func_prepare.php is with absolute path
    in PHP code and then including db_interface.php
    is with relative path. Just for testing ;)

    I have --prefix=/opt/httpd/dev-installation/php5 for
    configuring PHP and it even tries to stat() files
    from there. Result is failing includes. Truss
    output differs quite a lot from 5.1.6.

    #
    # php5.2-200611151130
    #

    25255: stat("./inc/config.php", 0xFFFFFD7FFFDFDF70) = 0
    25255: getcwd(0xFFFFFD7FFFDFD200, 1024) Err#13 EACCES
    [file_dac_read]
    25255: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    25255: getcwd(0xFFFFFD7FFFDFC500, 1024) Err#13 EACCES
    [file_dac_read]
    25255: stat("^B", 0xFFFFFD7FFFDFDE90) Err#2 ENOENT
    25255:
    stat("/opt/httpd/dev-installation/php5/lib/php/inc/config.php",0xFFFFFD7FFFDFDF70)
    Err#2 ENOENT
    25255:
    stat("/data/sites/www.mysite.example/dev-html/inc/config.php",0xFFFFFD7FFFDFDF70)
    = 0
    25255:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/config.php",
    "/data/sites/www.mysite.example/dev-html/inc/config.php", 1024) = 54
    25255: stat("/data/sites/www.mysite.example/dev-html/inc/config.php",
    0xFFFFFD7FFFDFDE90) = 0
    25255:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/config.php",
    "/data/sites/www.mysite.example/dev-html/inc/config.php", 1024) = 54
    25255:
    open("/data/sites/www.mysite.example/dev-html/inc/config.php",O_RDONLY)
    = 17
    25255: fstat(17, 0x007BCA68) = 0
    25255: read(17, " < ? p h p\n\n / / ".., 8192) = 1572
    25255: read(17, 0x007BCD10, 8192) = 0
    25255: close(17) = 0
    25255: time() = 1163596213
    25255:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    25255:
    stat("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",0xFFFFFD7FFFDFDE60)
    = 0
    25255:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    25255:
    open("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",O_RDONLY)
    = 17
    25255: fstat(17, 0x007BCA68) = 0
    25255: read(17, " < ? p h p\n\n / /\n".., 8192) = 1171
    25255: read(17, 0x007C1000, 8192) = 0
    25255: close(17) = 0
    25255: stat("./inc/db_interface.php", 0xFFFFFD7FFFDFD0C0) = 0
    25255: getcwd(0xFFFFFD7FFFDFC350, 1024) Err#13 EACCES
    [file_dac_read]
    25255: resolvepath("./inc/db_interface.php", "inc/db_interface.php",
    1024) = 20
    25255: getcwd(0xFFFFFD7FFFDFB650, 1024) Err#13 EACCES
    [file_dac_read]
    25255: stat("^C", 0xFFFFFD7FFFDFCFE0) Err#2 ENOENT
    25255:
    stat("/opt/httpd/dev-installation/php5/lib/php/inc/db_interface.php",
    0xFFFFFD7FFFDFD0C0) Err#2 ENOENT
    25255:
    stat("/data/sites/www.mysite.example/dev-html/inc/inc/db_interface.php",
    0xFFFFFD7FFFDFD0C0) Err#2 ENOENT
    25255: open("/data/logs/httpd/error_log-php",
    O_WRONLY|O_APPEND|O_CREAT,0666) = 17
    25255: lseek(17, 0, SEEK_END) = 9904
    25255: time() = 1163596213
    25255: fstat(17, 0xFFFFFD7FFFDFB990) = 0
    25255: fstat(17, 0xFFFFFD7FFFDFB8E0) = 0
    25255: ioctl(17, TCGETA, 0xFFFFFD7FFFDFB950) Err#25 ENOTTY
    25255: write(17, " [ 1 5 - N o v - 2 0 0 6".., 241) = 241
    25255: close(17) = 0
    25255: open("/data/logs/httpd/error_log-php",
    O_WRONLY|O_APPEND|O_CREAT,0666) = 17


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

    [2006-11-15 12:42:59] [email]tony2001@php.net[/email]

    Please try using this CVS snapshot:

    [url]http://snaps.php.net/php5.2-latest.tar.gz[/url]

    For Windows:

    [url]http://snaps.php.net/win32/php5.2-win32-latest.zip[/url]



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

    [2006-11-12 19:17:43] lampiluoto at gmail dot com

    Here is part of the truss output, I can provide the whole output if
    needed. After failing getcwd() 5.2.0 tries to open file with wrong
    path.

    #
    # PHP-5.1.6
    #

    662: stat("./inc/config.php", 0xFFFFFD7FFFDFDEE0) = 0
    662: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    662: getcwd(0xFFFFFD7FFFDFD160, 1024) Err#13 EACCES
    [file_dac_read]
    662: stat("./inc/config.php", 0xFFFFFD7FFFDFDE00) = 0
    662: getcwd(0xFFFFFD7FFFDFDA10, 1024) Err#13 EACCES
    [file_dac_read]
    662: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    662: getcwd(0xFFFFFD7FFFDFCCE0, 1024) Err#13 EACCES
    [file_dac_read]
    662: open("./inc/config.php", O_RDONLY) = 17
    662: fstat(17, 0x00783920) = 0
    662: lseek(17, 0, SEEK_CUR) = 0
    662: read(17, " < ? p h p\n\n / / ".., 8192) = 1572
    662: read(17, 0x0077F258, 8192) = 0
    662: read(17, 0x0077F258, 8192) = 0
    662: close(17) = 0
    662: time() = 1163357246

    #
    # PHP-5.2.0
    #

    17703: stat("./inc/config.php", 0xFFFFFD7FFFDFDFB0) = 0
    17703: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    17703: getcwd(0xFFFFFD7FFFDFD230, 1024) Err#13 EACCES
    [file_dac_read]
    17703: stat("./inc/config.php", 0xFFFFFD7FFFDFDED0) = 0
    17703: getcwd(0xFFFFFD7FFFDFDAE0, 1024) Err#13 EACCES
    [file_dac_read]
    17703: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    17703: getcwd(0xFFFFFD7FFFDFCDE0, 1024) Err#13 EACCES
    [file_dac_read]
    17703: open("/inc/config.php", O_RDONLY) Err#2 ENOENT
    17703: open("/data/logs/httpd/error_log-php",
    O_WRONLY|O_APPEND|O_CREAT,0666) = 17
    17703: lseek(17, 0, SEEK_END) = 0
    17703: time() = 1163358385
    17703: fstat(17, 0xFFFFFD7FFFDFC880) = 0
    17703: fstat(17, 0xFFFFFD7FFFDFC7D0) = 0
    17703: ioctl(17, TCGETA, 0xFFFFFD7FFFDFC840) Err#25 ENOTTY
    17703: write(17, " [ 1 2 - N o v - 2 0 0 6".., 224) = 224
    17703: close(17) = 0

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

    [2006-11-11 22:57:10] [email]rasmus@php.net[/email]

    Would it be possible for you to get us an strace or truss of a 5.1.6
    relative include and the same for a 5.2.0 one? I don't remember any
    getcwd() changes, but it sounds like there must have been one
    somewhere.

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

    [2006-11-02 22:38:02] lampiluoto at gmail dot com

    Description:
    ------------
    I upgraded to PHP 5.2.0 on Solaris 10 (amd64). Executing PHP code
    failed and produced errors as any require() or include() with relative
    path fails. With absolute path it's ok.

    The same code in same environment works fine on PHP 5.1.6.

    Reason might be that on Solaris getcwd() does not return current
    working directory unless user has read privileges from root directory
    to the current dir. Has something changed in 5.2.0 ?

    User running httpd does not have read privileges to every directory in
    Apache HTTPd's DocumentRoot path - it has only execute (x) privilege to
    part of the directories.


    Reproduce code:
    ---------------
    // this fails on 5.2.0 but works fine on 5.1.6
    require('config.php');

    // this works also on 5.2.0
    require('/absolute/path/to/config.php');

    Expected result:
    ----------------
    File config.inc should be read successfully. This require('config.php')
    works fine on PHP 5.1.6 but after upgrading to 5.2.0 on same
    environment, it does not.

    Actual result:
    --------------
    // with relative path
    [Fri Nov 03 00:13:15 2006] [error] [client x.x.x.x] PHP Warning:
    require(config.php) [<a href='function.require'>function.require</a>]:
    failed to open stream: No such file or directory in /path/to/index.php
    on line 3, referer: [url]http://mysite/index.php[/url]

    [Fri Nov 03 00:13:15 2006] [error] [client x.x.x.x] PHP Fatal error:
    require() [<a href='function.require'>function.require</a>]: Failed
    opening required 'config.php'
    (include_path='.:/opt/httpd/php5/lib/php') in /path/to/index.php on
    line 3, referer: [url]http://mysite/index.php[/url]



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


    --
    Edit this bug report at [url]http://bugs.php.net/?id=39351&edit=1[/url]
    lampiluoto at gmail dot com Guest

  7. #6

    Default #39351 [Com]: require and include fails to open file in current directory

    ID: 39351
    Comment by: php dot net at ryanfindley dot com
    Reported By: lampiluoto at gmail dot com
    Status: Open
    Bug Type: *Directory/Filesystem functions
    Operating System: Solaris10
    PHP Version: 5.2.0
    New Comment:

    I'm experiencing the same problem on OS X 10.4 PPC 64bit(G5), but not
    on OS X 10.4 Intel 32bit.

    If I revert my PHP install to 5.1.4, the problem goes away but using
    5.2.0 all of my include() and require() statements that use a relative
    path fail, and getcwd() returns ''


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

    [2006-11-15 13:30:33] lampiluoto at gmail dot com

    Here's truss output with php5.2-200611151130.

    There seems to be changes for stat()'ing the
    file and though it fixes the first
    include('inc/config.php') it causes problems
    later on.

    Including func_prepare.php is with absolute path
    in PHP code and then including db_interface.php
    is with relative path. Just for testing ;)

    I have --prefix=/opt/httpd/dev-installation/php5 for
    configuring PHP and it even tries to stat() files
    from there. Result is failing includes. Truss
    output differs quite a lot from 5.1.6.

    #
    # php5.2-200611151130
    #

    25255: stat("./inc/config.php", 0xFFFFFD7FFFDFDF70) = 0
    25255: getcwd(0xFFFFFD7FFFDFD200, 1024) Err#13 EACCES
    [file_dac_read]
    25255: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    25255: getcwd(0xFFFFFD7FFFDFC500, 1024) Err#13 EACCES
    [file_dac_read]
    25255: stat("^B", 0xFFFFFD7FFFDFDE90) Err#2 ENOENT
    25255:
    stat("/opt/httpd/dev-installation/php5/lib/php/inc/config.php",0xFFFFFD7FFFDFDF70)
    Err#2 ENOENT
    25255:
    stat("/data/sites/www.mysite.example/dev-html/inc/config.php",0xFFFFFD7FFFDFDF70)
    = 0
    25255:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/config.php",
    "/data/sites/www.mysite.example/dev-html/inc/config.php", 1024) = 54
    25255: stat("/data/sites/www.mysite.example/dev-html/inc/config.php",
    0xFFFFFD7FFFDFDE90) = 0
    25255:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/config.php",
    "/data/sites/www.mysite.example/dev-html/inc/config.php", 1024) = 54
    25255:
    open("/data/sites/www.mysite.example/dev-html/inc/config.php",O_RDONLY)
    = 17
    25255: fstat(17, 0x007BCA68) = 0
    25255: read(17, " < ? p h p\n\n / / ".., 8192) = 1572
    25255: read(17, 0x007BCD10, 8192) = 0
    25255: close(17) = 0
    25255: time() = 1163596213
    25255:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    25255:
    stat("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",0xFFFFFD7FFFDFDE60)
    = 0
    25255:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    25255:
    open("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",O_RDONLY)
    = 17
    25255: fstat(17, 0x007BCA68) = 0
    25255: read(17, " < ? p h p\n\n / /\n".., 8192) = 1171
    25255: read(17, 0x007C1000, 8192) = 0
    25255: close(17) = 0
    25255: stat("./inc/db_interface.php", 0xFFFFFD7FFFDFD0C0) = 0
    25255: getcwd(0xFFFFFD7FFFDFC350, 1024) Err#13 EACCES
    [file_dac_read]
    25255: resolvepath("./inc/db_interface.php", "inc/db_interface.php",
    1024) = 20
    25255: getcwd(0xFFFFFD7FFFDFB650, 1024) Err#13 EACCES
    [file_dac_read]
    25255: stat("^C", 0xFFFFFD7FFFDFCFE0) Err#2 ENOENT
    25255:
    stat("/opt/httpd/dev-installation/php5/lib/php/inc/db_interface.php",
    0xFFFFFD7FFFDFD0C0) Err#2 ENOENT
    25255:
    stat("/data/sites/www.mysite.example/dev-html/inc/inc/db_interface.php",
    0xFFFFFD7FFFDFD0C0) Err#2 ENOENT
    25255: open("/data/logs/httpd/error_log-php",
    O_WRONLY|O_APPEND|O_CREAT,0666) = 17
    25255: lseek(17, 0, SEEK_END) = 9904
    25255: time() = 1163596213
    25255: fstat(17, 0xFFFFFD7FFFDFB990) = 0
    25255: fstat(17, 0xFFFFFD7FFFDFB8E0) = 0
    25255: ioctl(17, TCGETA, 0xFFFFFD7FFFDFB950) Err#25 ENOTTY
    25255: write(17, " [ 1 5 - N o v - 2 0 0 6".., 241) = 241
    25255: close(17) = 0
    25255: open("/data/logs/httpd/error_log-php",
    O_WRONLY|O_APPEND|O_CREAT,0666) = 17

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

    [2006-11-15 12:42:59] [email]tony2001@php.net[/email]

    Please try using this CVS snapshot:

    [url]http://snaps.php.net/php5.2-latest.tar.gz[/url]

    For Windows:

    [url]http://snaps.php.net/win32/php5.2-win32-latest.zip[/url]



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

    [2006-11-12 19:17:43] lampiluoto at gmail dot com

    Here is part of the truss output, I can provide the whole output if
    needed. After failing getcwd() 5.2.0 tries to open file with wrong
    path.

    #
    # PHP-5.1.6
    #

    662: stat("./inc/config.php", 0xFFFFFD7FFFDFDEE0) = 0
    662: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    662: getcwd(0xFFFFFD7FFFDFD160, 1024) Err#13 EACCES
    [file_dac_read]
    662: stat("./inc/config.php", 0xFFFFFD7FFFDFDE00) = 0
    662: getcwd(0xFFFFFD7FFFDFDA10, 1024) Err#13 EACCES
    [file_dac_read]
    662: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    662: getcwd(0xFFFFFD7FFFDFCCE0, 1024) Err#13 EACCES
    [file_dac_read]
    662: open("./inc/config.php", O_RDONLY) = 17
    662: fstat(17, 0x00783920) = 0
    662: lseek(17, 0, SEEK_CUR) = 0
    662: read(17, " < ? p h p\n\n / / ".., 8192) = 1572
    662: read(17, 0x0077F258, 8192) = 0
    662: read(17, 0x0077F258, 8192) = 0
    662: close(17) = 0
    662: time() = 1163357246

    #
    # PHP-5.2.0
    #

    17703: stat("./inc/config.php", 0xFFFFFD7FFFDFDFB0) = 0
    17703: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    17703: getcwd(0xFFFFFD7FFFDFD230, 1024) Err#13 EACCES
    [file_dac_read]
    17703: stat("./inc/config.php", 0xFFFFFD7FFFDFDED0) = 0
    17703: getcwd(0xFFFFFD7FFFDFDAE0, 1024) Err#13 EACCES
    [file_dac_read]
    17703: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    17703: getcwd(0xFFFFFD7FFFDFCDE0, 1024) Err#13 EACCES
    [file_dac_read]
    17703: open("/inc/config.php", O_RDONLY) Err#2 ENOENT
    17703: open("/data/logs/httpd/error_log-php",
    O_WRONLY|O_APPEND|O_CREAT,0666) = 17
    17703: lseek(17, 0, SEEK_END) = 0
    17703: time() = 1163358385
    17703: fstat(17, 0xFFFFFD7FFFDFC880) = 0
    17703: fstat(17, 0xFFFFFD7FFFDFC7D0) = 0
    17703: ioctl(17, TCGETA, 0xFFFFFD7FFFDFC840) Err#25 ENOTTY
    17703: write(17, " [ 1 2 - N o v - 2 0 0 6".., 224) = 224
    17703: close(17) = 0

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

    [2006-11-11 22:57:10] [email]rasmus@php.net[/email]

    Would it be possible for you to get us an strace or truss of a 5.1.6
    relative include and the same for a 5.2.0 one? I don't remember any
    getcwd() changes, but it sounds like there must have been one
    somewhere.

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

    [2006-11-02 22:38:02] lampiluoto at gmail dot com

    Description:
    ------------
    I upgraded to PHP 5.2.0 on Solaris 10 (amd64). Executing PHP code
    failed and produced errors as any require() or include() with relative
    path fails. With absolute path it's ok.

    The same code in same environment works fine on PHP 5.1.6.

    Reason might be that on Solaris getcwd() does not return current
    working directory unless user has read privileges from root directory
    to the current dir. Has something changed in 5.2.0 ?

    User running httpd does not have read privileges to every directory in
    Apache HTTPd's DocumentRoot path - it has only execute (x) privilege to
    part of the directories.


    Reproduce code:
    ---------------
    // this fails on 5.2.0 but works fine on 5.1.6
    require('config.php');

    // this works also on 5.2.0
    require('/absolute/path/to/config.php');

    Expected result:
    ----------------
    File config.inc should be read successfully. This require('config.php')
    works fine on PHP 5.1.6 but after upgrading to 5.2.0 on same
    environment, it does not.

    Actual result:
    --------------
    // with relative path
    [Fri Nov 03 00:13:15 2006] [error] [client x.x.x.x] PHP Warning:
    require(config.php) [<a href='function.require'>function.require</a>]:
    failed to open stream: No such file or directory in /path/to/index.php
    on line 3, referer: [url]http://mysite/index.php[/url]

    [Fri Nov 03 00:13:15 2006] [error] [client x.x.x.x] PHP Fatal error:
    require() [<a href='function.require'>function.require</a>]: Failed
    opening required 'config.php'
    (include_path='.:/opt/httpd/php5/lib/php') in /path/to/index.php on
    line 3, referer: [url]http://mysite/index.php[/url]



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


    --
    Edit this bug report at [url]http://bugs.php.net/?id=39351&edit=1[/url]
    php dot net at ryanfindley dot com Guest

  8. #7

    Default #39351 [Com]: require and include fails to open file in current directory

    ID: 39351
    Comment by: php dot net at ryanfindley dot com
    Reported By: lampiluoto at gmail dot com
    Status: Open
    Bug Type: *Directory/Filesystem functions
    Operating System: Solaris10
    PHP Version: 5.2.0
    New Comment:

    I forgot to mention that I tried the snapshot listed in the comment
    from 15 Nov 12:42pm UTC (PHP 5.2.1-dev), and experienced the same
    problem


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

    [2006-12-05 23:06:42] php dot net at ryanfindley dot com

    I'm experiencing the same problem on OS X 10.4 PPC 64bit(G5), but not
    on OS X 10.4 Intel 32bit.

    If I revert my PHP install to 5.1.4, the problem goes away but using
    5.2.0 all of my include() and require() statements that use a relative
    path fail, and getcwd() returns ''

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

    [2006-11-15 13:30:33] lampiluoto at gmail dot com

    Here's truss output with php5.2-200611151130.

    There seems to be changes for stat()'ing the
    file and though it fixes the first
    include('inc/config.php') it causes problems
    later on.

    Including func_prepare.php is with absolute path
    in PHP code and then including db_interface.php
    is with relative path. Just for testing ;)

    I have --prefix=/opt/httpd/dev-installation/php5 for
    configuring PHP and it even tries to stat() files
    from there. Result is failing includes. Truss
    output differs quite a lot from 5.1.6.

    #
    # php5.2-200611151130
    #

    25255: stat("./inc/config.php", 0xFFFFFD7FFFDFDF70) = 0
    25255: getcwd(0xFFFFFD7FFFDFD200, 1024) Err#13 EACCES
    [file_dac_read]
    25255: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    25255: getcwd(0xFFFFFD7FFFDFC500, 1024) Err#13 EACCES
    [file_dac_read]
    25255: stat("^B", 0xFFFFFD7FFFDFDE90) Err#2 ENOENT
    25255:
    stat("/opt/httpd/dev-installation/php5/lib/php/inc/config.php",0xFFFFFD7FFFDFDF70)
    Err#2 ENOENT
    25255:
    stat("/data/sites/www.mysite.example/dev-html/inc/config.php",0xFFFFFD7FFFDFDF70)
    = 0
    25255:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/config.php",
    "/data/sites/www.mysite.example/dev-html/inc/config.php", 1024) = 54
    25255: stat("/data/sites/www.mysite.example/dev-html/inc/config.php",
    0xFFFFFD7FFFDFDE90) = 0
    25255:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/config.php",
    "/data/sites/www.mysite.example/dev-html/inc/config.php", 1024) = 54
    25255:
    open("/data/sites/www.mysite.example/dev-html/inc/config.php",O_RDONLY)
    = 17
    25255: fstat(17, 0x007BCA68) = 0
    25255: read(17, " < ? p h p\n\n / / ".., 8192) = 1572
    25255: read(17, 0x007BCD10, 8192) = 0
    25255: close(17) = 0
    25255: time() = 1163596213
    25255:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    25255:
    stat("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",0xFFFFFD7FFFDFDE60)
    = 0
    25255:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    25255:
    open("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",O_RDONLY)
    = 17
    25255: fstat(17, 0x007BCA68) = 0
    25255: read(17, " < ? p h p\n\n / /\n".., 8192) = 1171
    25255: read(17, 0x007C1000, 8192) = 0
    25255: close(17) = 0
    25255: stat("./inc/db_interface.php", 0xFFFFFD7FFFDFD0C0) = 0
    25255: getcwd(0xFFFFFD7FFFDFC350, 1024) Err#13 EACCES
    [file_dac_read]
    25255: resolvepath("./inc/db_interface.php", "inc/db_interface.php",
    1024) = 20
    25255: getcwd(0xFFFFFD7FFFDFB650, 1024) Err#13 EACCES
    [file_dac_read]
    25255: stat("^C", 0xFFFFFD7FFFDFCFE0) Err#2 ENOENT
    25255:
    stat("/opt/httpd/dev-installation/php5/lib/php/inc/db_interface.php",
    0xFFFFFD7FFFDFD0C0) Err#2 ENOENT
    25255:
    stat("/data/sites/www.mysite.example/dev-html/inc/inc/db_interface.php",
    0xFFFFFD7FFFDFD0C0) Err#2 ENOENT
    25255: open("/data/logs/httpd/error_log-php",
    O_WRONLY|O_APPEND|O_CREAT,0666) = 17
    25255: lseek(17, 0, SEEK_END) = 9904
    25255: time() = 1163596213
    25255: fstat(17, 0xFFFFFD7FFFDFB990) = 0
    25255: fstat(17, 0xFFFFFD7FFFDFB8E0) = 0
    25255: ioctl(17, TCGETA, 0xFFFFFD7FFFDFB950) Err#25 ENOTTY
    25255: write(17, " [ 1 5 - N o v - 2 0 0 6".., 241) = 241
    25255: close(17) = 0
    25255: open("/data/logs/httpd/error_log-php",
    O_WRONLY|O_APPEND|O_CREAT,0666) = 17

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

    [2006-11-15 12:42:59] [email]tony2001@php.net[/email]

    Please try using this CVS snapshot:

    [url]http://snaps.php.net/php5.2-latest.tar.gz[/url]

    For Windows:

    [url]http://snaps.php.net/win32/php5.2-win32-latest.zip[/url]



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

    [2006-11-12 19:17:43] lampiluoto at gmail dot com

    Here is part of the truss output, I can provide the whole output if
    needed. After failing getcwd() 5.2.0 tries to open file with wrong
    path.

    #
    # PHP-5.1.6
    #

    662: stat("./inc/config.php", 0xFFFFFD7FFFDFDEE0) = 0
    662: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    662: getcwd(0xFFFFFD7FFFDFD160, 1024) Err#13 EACCES
    [file_dac_read]
    662: stat("./inc/config.php", 0xFFFFFD7FFFDFDE00) = 0
    662: getcwd(0xFFFFFD7FFFDFDA10, 1024) Err#13 EACCES
    [file_dac_read]
    662: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    662: getcwd(0xFFFFFD7FFFDFCCE0, 1024) Err#13 EACCES
    [file_dac_read]
    662: open("./inc/config.php", O_RDONLY) = 17
    662: fstat(17, 0x00783920) = 0
    662: lseek(17, 0, SEEK_CUR) = 0
    662: read(17, " < ? p h p\n\n / / ".., 8192) = 1572
    662: read(17, 0x0077F258, 8192) = 0
    662: read(17, 0x0077F258, 8192) = 0
    662: close(17) = 0
    662: time() = 1163357246

    #
    # PHP-5.2.0
    #

    17703: stat("./inc/config.php", 0xFFFFFD7FFFDFDFB0) = 0
    17703: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    17703: getcwd(0xFFFFFD7FFFDFD230, 1024) Err#13 EACCES
    [file_dac_read]
    17703: stat("./inc/config.php", 0xFFFFFD7FFFDFDED0) = 0
    17703: getcwd(0xFFFFFD7FFFDFDAE0, 1024) Err#13 EACCES
    [file_dac_read]
    17703: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    17703: getcwd(0xFFFFFD7FFFDFCDE0, 1024) Err#13 EACCES
    [file_dac_read]
    17703: open("/inc/config.php", O_RDONLY) Err#2 ENOENT
    17703: open("/data/logs/httpd/error_log-php",
    O_WRONLY|O_APPEND|O_CREAT,0666) = 17
    17703: lseek(17, 0, SEEK_END) = 0
    17703: time() = 1163358385
    17703: fstat(17, 0xFFFFFD7FFFDFC880) = 0
    17703: fstat(17, 0xFFFFFD7FFFDFC7D0) = 0
    17703: ioctl(17, TCGETA, 0xFFFFFD7FFFDFC840) Err#25 ENOTTY
    17703: write(17, " [ 1 2 - N o v - 2 0 0 6".., 224) = 224
    17703: close(17) = 0

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

    [2006-11-11 22:57:10] [email]rasmus@php.net[/email]

    Would it be possible for you to get us an strace or truss of a 5.1.6
    relative include and the same for a 5.2.0 one? I don't remember any
    getcwd() changes, but it sounds like there must have been one
    somewhere.

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

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    [url]http://bugs.php.net/39351[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=39351&edit=1[/url]
    php dot net at ryanfindley dot com Guest

  9. #8

    Default #39351 [Com]: require and include fails to open file in current directory

    ID: 39351
    Comment by: webtech at get-telecom dot fr
    Reported By: lampiluoto at gmail dot com
    Status: Open
    Bug Type: *Directory/Filesystem functions
    Operating System: Solaris10
    PHP Version: 5.2.0
    New Comment:

    What's up about this bug ?


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

    [2006-12-05 23:30:09] php dot net at ryanfindley dot com

    I forgot to mention that I tried the snapshot listed in the comment
    from 15 Nov 12:42pm UTC (PHP 5.2.1-dev), and experienced the same
    problem

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

    [2006-12-05 23:06:42] php dot net at ryanfindley dot com

    I'm experiencing the same problem on OS X 10.4 PPC 64bit(G5), but not
    on OS X 10.4 Intel 32bit.

    If I revert my PHP install to 5.1.4, the problem goes away but using
    5.2.0 all of my include() and require() statements that use a relative
    path fail, and getcwd() returns ''

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

    [2006-11-15 13:30:33] lampiluoto at gmail dot com

    Here's truss output with php5.2-200611151130.

    There seems to be changes for stat()'ing the
    file and though it fixes the first
    include('inc/config.php') it causes problems
    later on.

    Including func_prepare.php is with absolute path
    in PHP code and then including db_interface.php
    is with relative path. Just for testing ;)

    I have --prefix=/opt/httpd/dev-installation/php5 for
    configuring PHP and it even tries to stat() files
    from there. Result is failing includes. Truss
    output differs quite a lot from 5.1.6.

    #
    # php5.2-200611151130
    #

    25255: stat("./inc/config.php", 0xFFFFFD7FFFDFDF70) = 0
    25255: getcwd(0xFFFFFD7FFFDFD200, 1024) Err#13 EACCES
    [file_dac_read]
    25255: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    25255: getcwd(0xFFFFFD7FFFDFC500, 1024) Err#13 EACCES
    [file_dac_read]
    25255: stat("^B", 0xFFFFFD7FFFDFDE90) Err#2 ENOENT
    25255:
    stat("/opt/httpd/dev-installation/php5/lib/php/inc/config.php",0xFFFFFD7FFFDFDF70)
    Err#2 ENOENT
    25255:
    stat("/data/sites/www.mysite.example/dev-html/inc/config.php",0xFFFFFD7FFFDFDF70)
    = 0
    25255:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/config.php",
    "/data/sites/www.mysite.example/dev-html/inc/config.php", 1024) = 54
    25255: stat("/data/sites/www.mysite.example/dev-html/inc/config.php",
    0xFFFFFD7FFFDFDE90) = 0
    25255:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/config.php",
    "/data/sites/www.mysite.example/dev-html/inc/config.php", 1024) = 54
    25255:
    open("/data/sites/www.mysite.example/dev-html/inc/config.php",O_RDONLY)
    = 17
    25255: fstat(17, 0x007BCA68) = 0
    25255: read(17, " < ? p h p\n\n / / ".., 8192) = 1572
    25255: read(17, 0x007BCD10, 8192) = 0
    25255: close(17) = 0
    25255: time() = 1163596213
    25255:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    25255:
    stat("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",0xFFFFFD7FFFDFDE60)
    = 0
    25255:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    25255:
    open("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",O_RDONLY)
    = 17
    25255: fstat(17, 0x007BCA68) = 0
    25255: read(17, " < ? p h p\n\n / /\n".., 8192) = 1171
    25255: read(17, 0x007C1000, 8192) = 0
    25255: close(17) = 0
    25255: stat("./inc/db_interface.php", 0xFFFFFD7FFFDFD0C0) = 0
    25255: getcwd(0xFFFFFD7FFFDFC350, 1024) Err#13 EACCES
    [file_dac_read]
    25255: resolvepath("./inc/db_interface.php", "inc/db_interface.php",
    1024) = 20
    25255: getcwd(0xFFFFFD7FFFDFB650, 1024) Err#13 EACCES
    [file_dac_read]
    25255: stat("^C", 0xFFFFFD7FFFDFCFE0) Err#2 ENOENT
    25255:
    stat("/opt/httpd/dev-installation/php5/lib/php/inc/db_interface.php",
    0xFFFFFD7FFFDFD0C0) Err#2 ENOENT
    25255:
    stat("/data/sites/www.mysite.example/dev-html/inc/inc/db_interface.php",
    0xFFFFFD7FFFDFD0C0) Err#2 ENOENT
    25255: open("/data/logs/httpd/error_log-php",
    O_WRONLY|O_APPEND|O_CREAT,0666) = 17
    25255: lseek(17, 0, SEEK_END) = 9904
    25255: time() = 1163596213
    25255: fstat(17, 0xFFFFFD7FFFDFB990) = 0
    25255: fstat(17, 0xFFFFFD7FFFDFB8E0) = 0
    25255: ioctl(17, TCGETA, 0xFFFFFD7FFFDFB950) Err#25 ENOTTY
    25255: write(17, " [ 1 5 - N o v - 2 0 0 6".., 241) = 241
    25255: close(17) = 0
    25255: open("/data/logs/httpd/error_log-php",
    O_WRONLY|O_APPEND|O_CREAT,0666) = 17

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

    [2006-11-15 12:42:59] [email]tony2001@php.net[/email]

    Please try using this CVS snapshot:

    [url]http://snaps.php.net/php5.2-latest.tar.gz[/url]

    For Windows:

    [url]http://snaps.php.net/win32/php5.2-win32-latest.zip[/url]



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

    [2006-11-12 19:17:43] lampiluoto at gmail dot com

    Here is part of the truss output, I can provide the whole output if
    needed. After failing getcwd() 5.2.0 tries to open file with wrong
    path.

    #
    # PHP-5.1.6
    #

    662: stat("./inc/config.php", 0xFFFFFD7FFFDFDEE0) = 0
    662: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    662: getcwd(0xFFFFFD7FFFDFD160, 1024) Err#13 EACCES
    [file_dac_read]
    662: stat("./inc/config.php", 0xFFFFFD7FFFDFDE00) = 0
    662: getcwd(0xFFFFFD7FFFDFDA10, 1024) Err#13 EACCES
    [file_dac_read]
    662: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    662: getcwd(0xFFFFFD7FFFDFCCE0, 1024) Err#13 EACCES
    [file_dac_read]
    662: open("./inc/config.php", O_RDONLY) = 17
    662: fstat(17, 0x00783920) = 0
    662: lseek(17, 0, SEEK_CUR) = 0
    662: read(17, " < ? p h p\n\n / / ".., 8192) = 1572
    662: read(17, 0x0077F258, 8192) = 0
    662: read(17, 0x0077F258, 8192) = 0
    662: close(17) = 0
    662: time() = 1163357246

    #
    # PHP-5.2.0
    #

    17703: stat("./inc/config.php", 0xFFFFFD7FFFDFDFB0) = 0
    17703: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    17703: getcwd(0xFFFFFD7FFFDFD230, 1024) Err#13 EACCES
    [file_dac_read]
    17703: stat("./inc/config.php", 0xFFFFFD7FFFDFDED0) = 0
    17703: getcwd(0xFFFFFD7FFFDFDAE0, 1024) Err#13 EACCES
    [file_dac_read]
    17703: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    17703: getcwd(0xFFFFFD7FFFDFCDE0, 1024) Err#13 EACCES
    [file_dac_read]
    17703: open("/inc/config.php", O_RDONLY) Err#2 ENOENT
    17703: open("/data/logs/httpd/error_log-php",
    O_WRONLY|O_APPEND|O_CREAT,0666) = 17
    17703: lseek(17, 0, SEEK_END) = 0
    17703: time() = 1163358385
    17703: fstat(17, 0xFFFFFD7FFFDFC880) = 0
    17703: fstat(17, 0xFFFFFD7FFFDFC7D0) = 0
    17703: ioctl(17, TCGETA, 0xFFFFFD7FFFDFC840) Err#25 ENOTTY
    17703: write(17, " [ 1 2 - N o v - 2 0 0 6".., 224) = 224
    17703: close(17) = 0

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

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    [url]http://bugs.php.net/39351[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=39351&edit=1[/url]
    webtech at get-telecom dot fr Guest

  10. #9

    Default #39351 [Opn]: require and include fails to open file in current directory

    ID: 39351
    User updated by: lampiluoto at gmail dot com
    Reported By: lampiluoto at gmail dot com
    Status: Open
    Bug Type: *Directory/Filesystem functions
    Operating System: Solaris10
    PHP Version: 5.2.0
    New Comment:

    Hello,

    This bug seem to exist also in PHP 5.2.1, it
    is behaving similarly to the 5.2.0 snapshot I
    tested. This is same PHP code I tested earlier.

    I remind that this is situation where httpd user
    doesn't have read privilege to every directory
    level in path. It has only execute/access (x)
    to some of the directories.

    #
    # 5.1.6 truss output
    #
    24204: stat("./inc/config.php", 0xFFFFFD7FFFDFE470) = 0
    24204: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    24204: getcwd(0xFFFFFD7FFFDFD6F0, 1024) Err#13 EACCES
    [file_dac_read]
    24204: stat("./inc/config.php", 0xFFFFFD7FFFDFE390) = 0
    24204: getcwd(0xFFFFFD7FFFDFDFA0, 1024) Err#13 EACCES
    [file_dac_read]
    24204: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    24204: getcwd(0xFFFFFD7FFFDFD270, 1024) Err#13 EACCES
    [file_dac_read]
    24204: open("./inc/config.php", O_RDONLY) = 34
    24204: fstat(34, 0x007E4F90) = 0
    24204: lseek(34, 0, SEEK_CUR) = 0
    24204: read(34, " < ? p h p\n\n / / ".., 8192) = 1572
    24204: read(34, 0x007E27F8, 8192) = 0
    24204: read(34, 0x007E27F8, 8192) = 0
    24204: close(34) = 0
    24204: time() = 1171039558
    24204:
    resolvepath("/data/sites/www.lampiluoto.net/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    24204:
    stat("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    0xFFFFFD7FFFDFE360) = 0
    24204:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    24204:
    open("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    O_RDONLY) = 34
    24204: fstat(34, 0x007E5F10) = 0
    24204: lseek(34, 0, SEEK_CUR) = 0
    24204: read(34, " < ? p h p\n\n / /\n".., 8192) = 1171
    24204: read(34, 0x007E6C28, 8192) = 0
    24204: read(34, 0x007E6C28, 8192) = 0
    24204: brk(0x007E8F20) = 0
    24204: brk(0x007ECF20) = 0
    24204: brk(0x007ECF20) = 0
    24204: brk(0x007ECF20) = 0
    24204: brk(0x007F0F20) = 0
    24204: close(34) = 0
    24204: stat("./inc/db_interface.php", 0xFFFFFD7FFFDFD9C0) = 0
    24204: resolvepath("./inc/db_interface.php", "inc/db_interface.php",
    1024) = 20
    24204: getcwd(0xFFFFFD7FFFDFCC40, 1024) Err#13 EACCES
    [file_dac_read]
    24204: stat("./inc/db_interface.php", 0xFFFFFD7FFFDFD8E0) = 0
    24204: getcwd(0xFFFFFD7FFFDFD4F0, 1024) Err#13 EACCES
    [file_dac_read]
    24204: resolvepath("./inc/db_interface.php", "inc/db_interface.php",
    1024) = 20
    24204: getcwd(0xFFFFFD7FFFDFC7C0, 1024) Err#13 EACCES
    [file_dac_read]
    24204: open("./inc/db_interface.php", O_RDONLY) = 34
    24204: fstat(34, 0x007E2E30) = 0
    24204: lseek(34, 0, SEEK_CUR) = 0
    24204: read(34, " < ? p h p\n\n / /\n / /".., 8192) = 502
    24204: read(34, 0x007E6C28, 8192) = 0
    24204: read(34, 0x007E6C28, 8192) = 0
    24204: close(34) = 0


    #
    # 5.2.1 truss output
    #
    23485: stat("./inc/config.php", 0xFFFFFD7FFFDFE0D0) = 0
    23485: getcwd(0xFFFFFD7FFFDFD360, 1024) Err#13 EACCES
    [file_dac_read]
    23485: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    23485: getcwd(0xFFFFFD7FFFDFC660, 1024) Err#13 EACCES
    [file_dac_read]
    23485: stat("/inc/config.php", 0xFFFFFD7FFFDFDFF0) Err#2 ENOENT
    23485: stat("/opt/httpd/dev-installation/php5/lib/php/inc/config.php",
    0xFFFFFD7FFFDFE0D0) Err#2 ENOENT
    23485: stat("/data/sites/www.mysite.example/dev-html/inc/config.php",
    0xFFFFFD7FFFDFE0D0) = 0
    23485:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/config.php",
    "/data/sites/www.mysite.example/dev-html/inc/config.php", 1024) = 54
    23485: stat("/data/sites/www.mysite.example/dev-html/inc/config.php",
    0xFFFFFD7FFFDFDFF0) = 0
    23485:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/config.php",
    "/data/sites/www.mysite.example/dev-html/inc/config.php", 1024) = 54
    23485: open("/data/sites/www.mysite.example/dev-html/inc/config.php",
    O_RDONLY) = 17
    23485: fstat(17, 0x005D0778) = 0
    23485: read(17, " < ? p h p\n\n / / ".., 8192) = 1572
    23485: read(17, 0x005D0A20, 8192) = 0
    23485: close(17) = 0
    23485: time() = 1171038559
    23485:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    23485:
    stat("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    0xFFFFFD7FFFDFDFC0) = 0
    23485:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    23485:
    open("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    O_RDONLY) = 17
    23485: fstat(17, 0x005D0778) = 0
    23485: read(17, " < ? p h p\n\n / /\n".., 8192) = 1171
    23485: read(17, 0x005D4D10, 8192) = 0
    23485: close(17) = 0
    23485: stat("./inc/db_interface.php", 0xFFFFFD7FFFDFD220) = 0
    23485: getcwd(0xFFFFFD7FFFDFC4B0, 1024) Err#13 EACCES
    [file_dac_read]
    23485: resolvepath("./inc/db_interface.php", "inc/db_interface.php",
    1024) = 20
    23485: getcwd(0xFFFFFD7FFFDFB7B0, 1024) Err#13 EACCES
    [file_dac_read]
    23485: stat("/inc/db_interface.php", 0xFFFFFD7FFFDFD140) Err#2 ENOENT
    23485:
    stat("/opt/httpd/dev-installation/php5/lib/php/inc/db_interface.php",
    0xFFFFFD7FFFDFD220) Err#2 ENOENT
    23485:
    stat("/data/sites/www.mysite.example/dev-html/inc/inc/db_interface.php",
    0xFFFFFD7FFFDFD220) Err#2 ENOENT
    23485: open("/data/logs/httpd/error_log-php",
    O_WRONLY|O_APPEND|O_CREAT, 0666) = 17
    23485: lseek(17, 0, SEEK_END) = 14856
    23485: time() = 1171038559
    23485: fstat(17, 0xFFFFFD7FFFDFBAE0) = 0
    23485: brk(0x007D0C60) = 0
    23485: brk(0x007D4C60) = 0
    23485: fstat(17, 0xFFFFFD7FFFDFBA30) = 0
    23485: ioctl(17, TCGETA, 0xFFFFFD7FFFDFBAA0) Err#25 ENOTTY
    23485: write(17, " [ 0 9 - F e b - 2 0 0 7".., 241) = 241
    23485: close(17) = 0
    23485: open("/data/logs/httpd/error_log-php",
    O_WRONLY|O_APPEND|O_CREAT, 0666) = 17


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

    [2007-02-08 14:03:58] webtech at get-telecom dot fr

    What's up about this bug ?

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

    [2006-12-05 23:30:09] php dot net at ryanfindley dot com

    I forgot to mention that I tried the snapshot listed in the comment
    from 15 Nov 12:42pm UTC (PHP 5.2.1-dev), and experienced the same
    problem

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

    [2006-12-05 23:06:42] php dot net at ryanfindley dot com

    I'm experiencing the same problem on OS X 10.4 PPC 64bit(G5), but not
    on OS X 10.4 Intel 32bit.

    If I revert my PHP install to 5.1.4, the problem goes away but using
    5.2.0 all of my include() and require() statements that use a relative
    path fail, and getcwd() returns ''

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

    [2006-11-15 13:30:33] lampiluoto at gmail dot com

    Here's truss output with php5.2-200611151130.

    There seems to be changes for stat()'ing the
    file and though it fixes the first
    include('inc/config.php') it causes problems
    later on.

    Including func_prepare.php is with absolute path
    in PHP code and then including db_interface.php
    is with relative path. Just for testing ;)

    I have --prefix=/opt/httpd/dev-installation/php5 for
    configuring PHP and it even tries to stat() files
    from there. Result is failing includes. Truss
    output differs quite a lot from 5.1.6.

    #
    # php5.2-200611151130
    #

    25255: stat("./inc/config.php", 0xFFFFFD7FFFDFDF70) = 0
    25255: getcwd(0xFFFFFD7FFFDFD200, 1024) Err#13 EACCES
    [file_dac_read]
    25255: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    25255: getcwd(0xFFFFFD7FFFDFC500, 1024) Err#13 EACCES
    [file_dac_read]
    25255: stat("^B", 0xFFFFFD7FFFDFDE90) Err#2 ENOENT
    25255:
    stat("/opt/httpd/dev-installation/php5/lib/php/inc/config.php",0xFFFFFD7FFFDFDF70)
    Err#2 ENOENT
    25255:
    stat("/data/sites/www.mysite.example/dev-html/inc/config.php",0xFFFFFD7FFFDFDF70)
    = 0
    25255:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/config.php",
    "/data/sites/www.mysite.example/dev-html/inc/config.php", 1024) = 54
    25255: stat("/data/sites/www.mysite.example/dev-html/inc/config.php",
    0xFFFFFD7FFFDFDE90) = 0
    25255:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/config.php",
    "/data/sites/www.mysite.example/dev-html/inc/config.php", 1024) = 54
    25255:
    open("/data/sites/www.mysite.example/dev-html/inc/config.php",O_RDONLY)
    = 17
    25255: fstat(17, 0x007BCA68) = 0
    25255: read(17, " < ? p h p\n\n / / ".., 8192) = 1572
    25255: read(17, 0x007BCD10, 8192) = 0
    25255: close(17) = 0
    25255: time() = 1163596213
    25255:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    25255:
    stat("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",0xFFFFFD7FFFDFDE60)
    = 0
    25255:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    25255:
    open("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",O_RDONLY)
    = 17
    25255: fstat(17, 0x007BCA68) = 0
    25255: read(17, " < ? p h p\n\n / /\n".., 8192) = 1171
    25255: read(17, 0x007C1000, 8192) = 0
    25255: close(17) = 0
    25255: stat("./inc/db_interface.php", 0xFFFFFD7FFFDFD0C0) = 0
    25255: getcwd(0xFFFFFD7FFFDFC350, 1024) Err#13 EACCES
    [file_dac_read]
    25255: resolvepath("./inc/db_interface.php", "inc/db_interface.php",
    1024) = 20
    25255: getcwd(0xFFFFFD7FFFDFB650, 1024) Err#13 EACCES
    [file_dac_read]
    25255: stat("^C", 0xFFFFFD7FFFDFCFE0) Err#2 ENOENT
    25255:
    stat("/opt/httpd/dev-installation/php5/lib/php/inc/db_interface.php",
    0xFFFFFD7FFFDFD0C0) Err#2 ENOENT
    25255:
    stat("/data/sites/www.mysite.example/dev-html/inc/inc/db_interface.php",
    0xFFFFFD7FFFDFD0C0) Err#2 ENOENT
    25255: open("/data/logs/httpd/error_log-php",
    O_WRONLY|O_APPEND|O_CREAT,0666) = 17
    25255: lseek(17, 0, SEEK_END) = 9904
    25255: time() = 1163596213
    25255: fstat(17, 0xFFFFFD7FFFDFB990) = 0
    25255: fstat(17, 0xFFFFFD7FFFDFB8E0) = 0
    25255: ioctl(17, TCGETA, 0xFFFFFD7FFFDFB950) Err#25 ENOTTY
    25255: write(17, " [ 1 5 - N o v - 2 0 0 6".., 241) = 241
    25255: close(17) = 0
    25255: open("/data/logs/httpd/error_log-php",
    O_WRONLY|O_APPEND|O_CREAT,0666) = 17

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

    [2006-11-15 12:42:59] [email]tony2001@php.net[/email]

    Please try using this CVS snapshot:

    [url]http://snaps.php.net/php5.2-latest.tar.gz[/url]

    For Windows:

    [url]http://snaps.php.net/win32/php5.2-win32-latest.zip[/url]



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

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    [url]http://bugs.php.net/39351[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=39351&edit=1[/url]
    lampiluoto at gmail dot com Guest

  11. #10

    Default #39351 [Com]: require and include fails to open file in current directory

    ID: 39351
    Comment by: webtech at get-telecom dot fr
    Reported By: lampiluoto at gmail dot com
    Status: Open
    Bug Type: *Directory/Filesystem functions
    Operating System: Solaris10
    PHP Version: 5.2.0
    New Comment:

    Is there a solution for this bug ?
    We're using PHP 5.1.6 and can't upgrade...


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

    [2007-02-09 16:54:55] lampiluoto at gmail dot com

    Hello,

    This bug seem to exist also in PHP 5.2.1, it
    is behaving similarly to the 5.2.0 snapshot I
    tested. This is same PHP code I tested earlier.

    I remind that this is situation where httpd user
    doesn't have read privilege to every directory
    level in path. It has only execute/access (x)
    to some of the directories.

    #
    # 5.1.6 truss output
    #
    24204: stat("./inc/config.php", 0xFFFFFD7FFFDFE470) = 0
    24204: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    24204: getcwd(0xFFFFFD7FFFDFD6F0, 1024) Err#13 EACCES
    [file_dac_read]
    24204: stat("./inc/config.php", 0xFFFFFD7FFFDFE390) = 0
    24204: getcwd(0xFFFFFD7FFFDFDFA0, 1024) Err#13 EACCES
    [file_dac_read]
    24204: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    24204: getcwd(0xFFFFFD7FFFDFD270, 1024) Err#13 EACCES
    [file_dac_read]
    24204: open("./inc/config.php", O_RDONLY) = 34
    24204: fstat(34, 0x007E4F90) = 0
    24204: lseek(34, 0, SEEK_CUR) = 0
    24204: read(34, " < ? p h p\n\n / / ".., 8192) = 1572
    24204: read(34, 0x007E27F8, 8192) = 0
    24204: read(34, 0x007E27F8, 8192) = 0
    24204: close(34) = 0
    24204: time() = 1171039558
    24204:
    resolvepath("/data/sites/www.lampiluoto.net/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    24204:
    stat("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    0xFFFFFD7FFFDFE360) = 0
    24204:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    24204:
    open("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    O_RDONLY) = 34
    24204: fstat(34, 0x007E5F10) = 0
    24204: lseek(34, 0, SEEK_CUR) = 0
    24204: read(34, " < ? p h p\n\n / /\n".., 8192) = 1171
    24204: read(34, 0x007E6C28, 8192) = 0
    24204: read(34, 0x007E6C28, 8192) = 0
    24204: brk(0x007E8F20) = 0
    24204: brk(0x007ECF20) = 0
    24204: brk(0x007ECF20) = 0
    24204: brk(0x007ECF20) = 0
    24204: brk(0x007F0F20) = 0
    24204: close(34) = 0
    24204: stat("./inc/db_interface.php", 0xFFFFFD7FFFDFD9C0) = 0
    24204: resolvepath("./inc/db_interface.php", "inc/db_interface.php",
    1024) = 20
    24204: getcwd(0xFFFFFD7FFFDFCC40, 1024) Err#13 EACCES
    [file_dac_read]
    24204: stat("./inc/db_interface.php", 0xFFFFFD7FFFDFD8E0) = 0
    24204: getcwd(0xFFFFFD7FFFDFD4F0, 1024) Err#13 EACCES
    [file_dac_read]
    24204: resolvepath("./inc/db_interface.php", "inc/db_interface.php",
    1024) = 20
    24204: getcwd(0xFFFFFD7FFFDFC7C0, 1024) Err#13 EACCES
    [file_dac_read]
    24204: open("./inc/db_interface.php", O_RDONLY) = 34
    24204: fstat(34, 0x007E2E30) = 0
    24204: lseek(34, 0, SEEK_CUR) = 0
    24204: read(34, " < ? p h p\n\n / /\n / /".., 8192) = 502
    24204: read(34, 0x007E6C28, 8192) = 0
    24204: read(34, 0x007E6C28, 8192) = 0
    24204: close(34) = 0


    #
    # 5.2.1 truss output
    #
    23485: stat("./inc/config.php", 0xFFFFFD7FFFDFE0D0) = 0
    23485: getcwd(0xFFFFFD7FFFDFD360, 1024) Err#13 EACCES
    [file_dac_read]
    23485: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    23485: getcwd(0xFFFFFD7FFFDFC660, 1024) Err#13 EACCES
    [file_dac_read]
    23485: stat("/inc/config.php", 0xFFFFFD7FFFDFDFF0) Err#2 ENOENT
    23485: stat("/opt/httpd/dev-installation/php5/lib/php/inc/config.php",
    0xFFFFFD7FFFDFE0D0) Err#2 ENOENT
    23485: stat("/data/sites/www.mysite.example/dev-html/inc/config.php",
    0xFFFFFD7FFFDFE0D0) = 0
    23485:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/config.php",
    "/data/sites/www.mysite.example/dev-html/inc/config.php", 1024) = 54
    23485: stat("/data/sites/www.mysite.example/dev-html/inc/config.php",
    0xFFFFFD7FFFDFDFF0) = 0
    23485:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/config.php",
    "/data/sites/www.mysite.example/dev-html/inc/config.php", 1024) = 54
    23485: open("/data/sites/www.mysite.example/dev-html/inc/config.php",
    O_RDONLY) = 17
    23485: fstat(17, 0x005D0778) = 0
    23485: read(17, " < ? p h p\n\n / / ".., 8192) = 1572
    23485: read(17, 0x005D0A20, 8192) = 0
    23485: close(17) = 0
    23485: time() = 1171038559
    23485:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    23485:
    stat("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    0xFFFFFD7FFFDFDFC0) = 0
    23485:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    23485:
    open("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    O_RDONLY) = 17
    23485: fstat(17, 0x005D0778) = 0
    23485: read(17, " < ? p h p\n\n / /\n".., 8192) = 1171
    23485: read(17, 0x005D4D10, 8192) = 0
    23485: close(17) = 0
    23485: stat("./inc/db_interface.php", 0xFFFFFD7FFFDFD220) = 0
    23485: getcwd(0xFFFFFD7FFFDFC4B0, 1024) Err#13 EACCES
    [file_dac_read]
    23485: resolvepath("./inc/db_interface.php", "inc/db_interface.php",
    1024) = 20
    23485: getcwd(0xFFFFFD7FFFDFB7B0, 1024) Err#13 EACCES
    [file_dac_read]
    23485: stat("/inc/db_interface.php", 0xFFFFFD7FFFDFD140) Err#2 ENOENT
    23485:
    stat("/opt/httpd/dev-installation/php5/lib/php/inc/db_interface.php",
    0xFFFFFD7FFFDFD220) Err#2 ENOENT
    23485:
    stat("/data/sites/www.mysite.example/dev-html/inc/inc/db_interface.php",
    0xFFFFFD7FFFDFD220) Err#2 ENOENT
    23485: open("/data/logs/httpd/error_log-php",
    O_WRONLY|O_APPEND|O_CREAT, 0666) = 17
    23485: lseek(17, 0, SEEK_END) = 14856
    23485: time() = 1171038559
    23485: fstat(17, 0xFFFFFD7FFFDFBAE0) = 0
    23485: brk(0x007D0C60) = 0
    23485: brk(0x007D4C60) = 0
    23485: fstat(17, 0xFFFFFD7FFFDFBA30) = 0
    23485: ioctl(17, TCGETA, 0xFFFFFD7FFFDFBAA0) Err#25 ENOTTY
    23485: write(17, " [ 0 9 - F e b - 2 0 0 7".., 241) = 241
    23485: close(17) = 0
    23485: open("/data/logs/httpd/error_log-php",
    O_WRONLY|O_APPEND|O_CREAT, 0666) = 17

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

    [2007-02-08 14:03:58] webtech at get-telecom dot fr

    What's up about this bug ?

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

    [2006-12-05 23:30:09] php dot net at ryanfindley dot com

    I forgot to mention that I tried the snapshot listed in the comment
    from 15 Nov 12:42pm UTC (PHP 5.2.1-dev), and experienced the same
    problem

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

    [2006-12-05 23:06:42] php dot net at ryanfindley dot com

    I'm experiencing the same problem on OS X 10.4 PPC 64bit(G5), but not
    on OS X 10.4 Intel 32bit.

    If I revert my PHP install to 5.1.4, the problem goes away but using
    5.2.0 all of my include() and require() statements that use a relative
    path fail, and getcwd() returns ''

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

    [2006-11-15 13:30:33] lampiluoto at gmail dot com

    Here's truss output with php5.2-200611151130.

    There seems to be changes for stat()'ing the
    file and though it fixes the first
    include('inc/config.php') it causes problems
    later on.

    Including func_prepare.php is with absolute path
    in PHP code and then including db_interface.php
    is with relative path. Just for testing ;)

    I have --prefix=/opt/httpd/dev-installation/php5 for
    configuring PHP and it even tries to stat() files
    from there. Result is failing includes. Truss
    output differs quite a lot from 5.1.6.

    #
    # php5.2-200611151130
    #

    25255: stat("./inc/config.php", 0xFFFFFD7FFFDFDF70) = 0
    25255: getcwd(0xFFFFFD7FFFDFD200, 1024) Err#13 EACCES
    [file_dac_read]
    25255: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    25255: getcwd(0xFFFFFD7FFFDFC500, 1024) Err#13 EACCES
    [file_dac_read]
    25255: stat("^B", 0xFFFFFD7FFFDFDE90) Err#2 ENOENT
    25255:
    stat("/opt/httpd/dev-installation/php5/lib/php/inc/config.php",0xFFFFFD7FFFDFDF70)
    Err#2 ENOENT
    25255:
    stat("/data/sites/www.mysite.example/dev-html/inc/config.php",0xFFFFFD7FFFDFDF70)
    = 0
    25255:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/config.php",
    "/data/sites/www.mysite.example/dev-html/inc/config.php", 1024) = 54
    25255: stat("/data/sites/www.mysite.example/dev-html/inc/config.php",
    0xFFFFFD7FFFDFDE90) = 0
    25255:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/config.php",
    "/data/sites/www.mysite.example/dev-html/inc/config.php", 1024) = 54
    25255:
    open("/data/sites/www.mysite.example/dev-html/inc/config.php",O_RDONLY)
    = 17
    25255: fstat(17, 0x007BCA68) = 0
    25255: read(17, " < ? p h p\n\n / / ".., 8192) = 1572
    25255: read(17, 0x007BCD10, 8192) = 0
    25255: close(17) = 0
    25255: time() = 1163596213
    25255:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    25255:
    stat("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",0xFFFFFD7FFFDFDE60)
    = 0
    25255:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    25255:
    open("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",O_RDONLY)
    = 17
    25255: fstat(17, 0x007BCA68) = 0
    25255: read(17, " < ? p h p\n\n / /\n".., 8192) = 1171
    25255: read(17, 0x007C1000, 8192) = 0
    25255: close(17) = 0
    25255: stat("./inc/db_interface.php", 0xFFFFFD7FFFDFD0C0) = 0
    25255: getcwd(0xFFFFFD7FFFDFC350, 1024) Err#13 EACCES
    [file_dac_read]
    25255: resolvepath("./inc/db_interface.php", "inc/db_interface.php",
    1024) = 20
    25255: getcwd(0xFFFFFD7FFFDFB650, 1024) Err#13 EACCES
    [file_dac_read]
    25255: stat("^C", 0xFFFFFD7FFFDFCFE0) Err#2 ENOENT
    25255:
    stat("/opt/httpd/dev-installation/php5/lib/php/inc/db_interface.php",
    0xFFFFFD7FFFDFD0C0) Err#2 ENOENT
    25255:
    stat("/data/sites/www.mysite.example/dev-html/inc/inc/db_interface.php",
    0xFFFFFD7FFFDFD0C0) Err#2 ENOENT
    25255: open("/data/logs/httpd/error_log-php",
    O_WRONLY|O_APPEND|O_CREAT,0666) = 17
    25255: lseek(17, 0, SEEK_END) = 9904
    25255: time() = 1163596213
    25255: fstat(17, 0xFFFFFD7FFFDFB990) = 0
    25255: fstat(17, 0xFFFFFD7FFFDFB8E0) = 0
    25255: ioctl(17, TCGETA, 0xFFFFFD7FFFDFB950) Err#25 ENOTTY
    25255: write(17, " [ 1 5 - N o v - 2 0 0 6".., 241) = 241
    25255: close(17) = 0
    25255: open("/data/logs/httpd/error_log-php",
    O_WRONLY|O_APPEND|O_CREAT,0666) = 17

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

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    [url]http://bugs.php.net/39351[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=39351&edit=1[/url]
    webtech at get-telecom dot fr Guest

  12. #11

    Default #39351 [Com]: require and include fails to open file in current directory

    ID: 39351
    Comment by: mcmullent at gmail dot com
    Reported By: lampiluoto at gmail dot com
    Status: Open
    Bug Type: *Directory/Filesystem functions
    Operating System: Solaris10
    PHP Version: 5.2.0
    New Comment:

    Is there any chance you need to add:

    allow_url_include = On

    to your php.ini? My php.ini file (from a previous PHP5 release) did not
    have allow_url_include, and when I tried to upgrade from 5.1.6 to 5.2.x,
    I was getting similar errors. When I set allow_url_include, I was able
    to upgrade to 5.2.1 without any issues.


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

    [2007-02-23 10:28:08] webtech at get-telecom dot fr

    Is there a solution for this bug ?
    We're using PHP 5.1.6 and can't upgrade...

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

    [2007-02-09 16:54:55] lampiluoto at gmail dot com

    Hello,

    This bug seem to exist also in PHP 5.2.1, it
    is behaving similarly to the 5.2.0 snapshot I
    tested. This is same PHP code I tested earlier.

    I remind that this is situation where httpd user
    doesn't have read privilege to every directory
    level in path. It has only execute/access (x)
    to some of the directories.

    #
    # 5.1.6 truss output
    #
    24204: stat("./inc/config.php", 0xFFFFFD7FFFDFE470) = 0
    24204: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    24204: getcwd(0xFFFFFD7FFFDFD6F0, 1024) Err#13 EACCES
    [file_dac_read]
    24204: stat("./inc/config.php", 0xFFFFFD7FFFDFE390) = 0
    24204: getcwd(0xFFFFFD7FFFDFDFA0, 1024) Err#13 EACCES
    [file_dac_read]
    24204: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    24204: getcwd(0xFFFFFD7FFFDFD270, 1024) Err#13 EACCES
    [file_dac_read]
    24204: open("./inc/config.php", O_RDONLY) = 34
    24204: fstat(34, 0x007E4F90) = 0
    24204: lseek(34, 0, SEEK_CUR) = 0
    24204: read(34, " < ? p h p\n\n / / ".., 8192) = 1572
    24204: read(34, 0x007E27F8, 8192) = 0
    24204: read(34, 0x007E27F8, 8192) = 0
    24204: close(34) = 0
    24204: time() = 1171039558
    24204:
    resolvepath("/data/sites/www.lampiluoto.net/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    24204:
    stat("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    0xFFFFFD7FFFDFE360) = 0
    24204:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    24204:
    open("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    O_RDONLY) = 34
    24204: fstat(34, 0x007E5F10) = 0
    24204: lseek(34, 0, SEEK_CUR) = 0
    24204: read(34, " < ? p h p\n\n / /\n".., 8192) = 1171
    24204: read(34, 0x007E6C28, 8192) = 0
    24204: read(34, 0x007E6C28, 8192) = 0
    24204: brk(0x007E8F20) = 0
    24204: brk(0x007ECF20) = 0
    24204: brk(0x007ECF20) = 0
    24204: brk(0x007ECF20) = 0
    24204: brk(0x007F0F20) = 0
    24204: close(34) = 0
    24204: stat("./inc/db_interface.php", 0xFFFFFD7FFFDFD9C0) = 0
    24204: resolvepath("./inc/db_interface.php", "inc/db_interface.php",
    1024) = 20
    24204: getcwd(0xFFFFFD7FFFDFCC40, 1024) Err#13 EACCES
    [file_dac_read]
    24204: stat("./inc/db_interface.php", 0xFFFFFD7FFFDFD8E0) = 0
    24204: getcwd(0xFFFFFD7FFFDFD4F0, 1024) Err#13 EACCES
    [file_dac_read]
    24204: resolvepath("./inc/db_interface.php", "inc/db_interface.php",
    1024) = 20
    24204: getcwd(0xFFFFFD7FFFDFC7C0, 1024) Err#13 EACCES
    [file_dac_read]
    24204: open("./inc/db_interface.php", O_RDONLY) = 34
    24204: fstat(34, 0x007E2E30) = 0
    24204: lseek(34, 0, SEEK_CUR) = 0
    24204: read(34, " < ? p h p\n\n / /\n / /".., 8192) = 502
    24204: read(34, 0x007E6C28, 8192) = 0
    24204: read(34, 0x007E6C28, 8192) = 0
    24204: close(34) = 0


    #
    # 5.2.1 truss output
    #
    23485: stat("./inc/config.php", 0xFFFFFD7FFFDFE0D0) = 0
    23485: getcwd(0xFFFFFD7FFFDFD360, 1024) Err#13 EACCES
    [file_dac_read]
    23485: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    23485: getcwd(0xFFFFFD7FFFDFC660, 1024) Err#13 EACCES
    [file_dac_read]
    23485: stat("/inc/config.php", 0xFFFFFD7FFFDFDFF0) Err#2 ENOENT
    23485: stat("/opt/httpd/dev-installation/php5/lib/php/inc/config.php",
    0xFFFFFD7FFFDFE0D0) Err#2 ENOENT
    23485: stat("/data/sites/www.mysite.example/dev-html/inc/config.php",
    0xFFFFFD7FFFDFE0D0) = 0
    23485:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/config.php",
    "/data/sites/www.mysite.example/dev-html/inc/config.php", 1024) = 54
    23485: stat("/data/sites/www.mysite.example/dev-html/inc/config.php",
    0xFFFFFD7FFFDFDFF0) = 0
    23485:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/config.php",
    "/data/sites/www.mysite.example/dev-html/inc/config.php", 1024) = 54
    23485: open("/data/sites/www.mysite.example/dev-html/inc/config.php",
    O_RDONLY) = 17
    23485: fstat(17, 0x005D0778) = 0
    23485: read(17, " < ? p h p\n\n / / ".., 8192) = 1572
    23485: read(17, 0x005D0A20, 8192) = 0
    23485: close(17) = 0
    23485: time() = 1171038559
    23485:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    23485:
    stat("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    0xFFFFFD7FFFDFDFC0) = 0
    23485:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    23485:
    open("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    O_RDONLY) = 17
    23485: fstat(17, 0x005D0778) = 0
    23485: read(17, " < ? p h p\n\n / /\n".., 8192) = 1171
    23485: read(17, 0x005D4D10, 8192) = 0
    23485: close(17) = 0
    23485: stat("./inc/db_interface.php", 0xFFFFFD7FFFDFD220) = 0
    23485: getcwd(0xFFFFFD7FFFDFC4B0, 1024) Err#13 EACCES
    [file_dac_read]
    23485: resolvepath("./inc/db_interface.php", "inc/db_interface.php",
    1024) = 20
    23485: getcwd(0xFFFFFD7FFFDFB7B0, 1024) Err#13 EACCES
    [file_dac_read]
    23485: stat("/inc/db_interface.php", 0xFFFFFD7FFFDFD140) Err#2 ENOENT
    23485:
    stat("/opt/httpd/dev-installation/php5/lib/php/inc/db_interface.php",
    0xFFFFFD7FFFDFD220) Err#2 ENOENT
    23485:
    stat("/data/sites/www.mysite.example/dev-html/inc/inc/db_interface.php",
    0xFFFFFD7FFFDFD220) Err#2 ENOENT
    23485: open("/data/logs/httpd/error_log-php",
    O_WRONLY|O_APPEND|O_CREAT, 0666) = 17
    23485: lseek(17, 0, SEEK_END) = 14856
    23485: time() = 1171038559
    23485: fstat(17, 0xFFFFFD7FFFDFBAE0) = 0
    23485: brk(0x007D0C60) = 0
    23485: brk(0x007D4C60) = 0
    23485: fstat(17, 0xFFFFFD7FFFDFBA30) = 0
    23485: ioctl(17, TCGETA, 0xFFFFFD7FFFDFBAA0) Err#25 ENOTTY
    23485: write(17, " [ 0 9 - F e b - 2 0 0 7".., 241) = 241
    23485: close(17) = 0
    23485: open("/data/logs/httpd/error_log-php",
    O_WRONLY|O_APPEND|O_CREAT, 0666) = 17

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

    [2007-02-08 14:03:58] webtech at get-telecom dot fr

    What's up about this bug ?

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

    [2006-12-05 23:30:09] php dot net at ryanfindley dot com

    I forgot to mention that I tried the snapshot listed in the comment
    from 15 Nov 12:42pm UTC (PHP 5.2.1-dev), and experienced the same
    problem

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

    [2006-12-05 23:06:42] php dot net at ryanfindley dot com

    I'm experiencing the same problem on OS X 10.4 PPC 64bit(G5), but not
    on OS X 10.4 Intel 32bit.

    If I revert my PHP install to 5.1.4, the problem goes away but using
    5.2.0 all of my include() and require() statements that use a relative
    path fail, and getcwd() returns ''

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

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    [url]http://bugs.php.net/39351[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=39351&edit=1[/url]
    mcmullent at gmail dot com Guest

  13. #12

    Default #39351 [Com]: require and include fails to open file in current directory

    ID: 39351
    Comment by: mail at unleadedonline dot net
    Reported By: lampiluoto at gmail dot com
    Status: Open
    Bug Type: *Directory/Filesystem functions
    Operating System: Solaris10
    PHP Version: 5.2.0
    New Comment:

    Anybody looking to fix this bug?

    We have the same setup as the original bug submitter, and can't upgrade
    from 5.1.6 to 5.2.1 because of this issue!

    It's a showstopper.


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

    [2007-02-27 20:27:11] mcmullent at gmail dot com

    Is there any chance you need to add:

    allow_url_include = On

    to your php.ini? My php.ini file (from a previous PHP5 release) did not
    have allow_url_include, and when I tried to upgrade from 5.1.6 to 5.2.x,
    I was getting similar errors. When I set allow_url_include, I was able
    to upgrade to 5.2.1 without any issues.

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

    [2007-02-23 10:28:08] webtech at get-telecom dot fr

    Is there a solution for this bug ?
    We're using PHP 5.1.6 and can't upgrade...

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

    [2007-02-09 16:54:55] lampiluoto at gmail dot com

    Hello,

    This bug seem to exist also in PHP 5.2.1, it
    is behaving similarly to the 5.2.0 snapshot I
    tested. This is same PHP code I tested earlier.

    I remind that this is situation where httpd user
    doesn't have read privilege to every directory
    level in path. It has only execute/access (x)
    to some of the directories.

    #
    # 5.1.6 truss output
    #
    24204: stat("./inc/config.php", 0xFFFFFD7FFFDFE470) = 0
    24204: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    24204: getcwd(0xFFFFFD7FFFDFD6F0, 1024) Err#13 EACCES
    [file_dac_read]
    24204: stat("./inc/config.php", 0xFFFFFD7FFFDFE390) = 0
    24204: getcwd(0xFFFFFD7FFFDFDFA0, 1024) Err#13 EACCES
    [file_dac_read]
    24204: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    24204: getcwd(0xFFFFFD7FFFDFD270, 1024) Err#13 EACCES
    [file_dac_read]
    24204: open("./inc/config.php", O_RDONLY) = 34
    24204: fstat(34, 0x007E4F90) = 0
    24204: lseek(34, 0, SEEK_CUR) = 0
    24204: read(34, " < ? p h p\n\n / / ".., 8192) = 1572
    24204: read(34, 0x007E27F8, 8192) = 0
    24204: read(34, 0x007E27F8, 8192) = 0
    24204: close(34) = 0
    24204: time() = 1171039558
    24204:
    resolvepath("/data/sites/www.lampiluoto.net/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    24204:
    stat("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    0xFFFFFD7FFFDFE360) = 0
    24204:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    24204:
    open("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    O_RDONLY) = 34
    24204: fstat(34, 0x007E5F10) = 0
    24204: lseek(34, 0, SEEK_CUR) = 0
    24204: read(34, " < ? p h p\n\n / /\n".., 8192) = 1171
    24204: read(34, 0x007E6C28, 8192) = 0
    24204: read(34, 0x007E6C28, 8192) = 0
    24204: brk(0x007E8F20) = 0
    24204: brk(0x007ECF20) = 0
    24204: brk(0x007ECF20) = 0
    24204: brk(0x007ECF20) = 0
    24204: brk(0x007F0F20) = 0
    24204: close(34) = 0
    24204: stat("./inc/db_interface.php", 0xFFFFFD7FFFDFD9C0) = 0
    24204: resolvepath("./inc/db_interface.php", "inc/db_interface.php",
    1024) = 20
    24204: getcwd(0xFFFFFD7FFFDFCC40, 1024) Err#13 EACCES
    [file_dac_read]
    24204: stat("./inc/db_interface.php", 0xFFFFFD7FFFDFD8E0) = 0
    24204: getcwd(0xFFFFFD7FFFDFD4F0, 1024) Err#13 EACCES
    [file_dac_read]
    24204: resolvepath("./inc/db_interface.php", "inc/db_interface.php",
    1024) = 20
    24204: getcwd(0xFFFFFD7FFFDFC7C0, 1024) Err#13 EACCES
    [file_dac_read]
    24204: open("./inc/db_interface.php", O_RDONLY) = 34
    24204: fstat(34, 0x007E2E30) = 0
    24204: lseek(34, 0, SEEK_CUR) = 0
    24204: read(34, " < ? p h p\n\n / /\n / /".., 8192) = 502
    24204: read(34, 0x007E6C28, 8192) = 0
    24204: read(34, 0x007E6C28, 8192) = 0
    24204: close(34) = 0


    #
    # 5.2.1 truss output
    #
    23485: stat("./inc/config.php", 0xFFFFFD7FFFDFE0D0) = 0
    23485: getcwd(0xFFFFFD7FFFDFD360, 1024) Err#13 EACCES
    [file_dac_read]
    23485: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    23485: getcwd(0xFFFFFD7FFFDFC660, 1024) Err#13 EACCES
    [file_dac_read]
    23485: stat("/inc/config.php", 0xFFFFFD7FFFDFDFF0) Err#2 ENOENT
    23485: stat("/opt/httpd/dev-installation/php5/lib/php/inc/config.php",
    0xFFFFFD7FFFDFE0D0) Err#2 ENOENT
    23485: stat("/data/sites/www.mysite.example/dev-html/inc/config.php",
    0xFFFFFD7FFFDFE0D0) = 0
    23485:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/config.php",
    "/data/sites/www.mysite.example/dev-html/inc/config.php", 1024) = 54
    23485: stat("/data/sites/www.mysite.example/dev-html/inc/config.php",
    0xFFFFFD7FFFDFDFF0) = 0
    23485:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/config.php",
    "/data/sites/www.mysite.example/dev-html/inc/config.php", 1024) = 54
    23485: open("/data/sites/www.mysite.example/dev-html/inc/config.php",
    O_RDONLY) = 17
    23485: fstat(17, 0x005D0778) = 0
    23485: read(17, " < ? p h p\n\n / / ".., 8192) = 1572
    23485: read(17, 0x005D0A20, 8192) = 0
    23485: close(17) = 0
    23485: time() = 1171038559
    23485:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    23485:
    stat("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    0xFFFFFD7FFFDFDFC0) = 0
    23485:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    23485:
    open("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    O_RDONLY) = 17
    23485: fstat(17, 0x005D0778) = 0
    23485: read(17, " < ? p h p\n\n / /\n".., 8192) = 1171
    23485: read(17, 0x005D4D10, 8192) = 0
    23485: close(17) = 0
    23485: stat("./inc/db_interface.php", 0xFFFFFD7FFFDFD220) = 0
    23485: getcwd(0xFFFFFD7FFFDFC4B0, 1024) Err#13 EACCES
    [file_dac_read]
    23485: resolvepath("./inc/db_interface.php", "inc/db_interface.php",
    1024) = 20
    23485: getcwd(0xFFFFFD7FFFDFB7B0, 1024) Err#13 EACCES
    [file_dac_read]
    23485: stat("/inc/db_interface.php", 0xFFFFFD7FFFDFD140) Err#2 ENOENT
    23485:
    stat("/opt/httpd/dev-installation/php5/lib/php/inc/db_interface.php",
    0xFFFFFD7FFFDFD220) Err#2 ENOENT
    23485:
    stat("/data/sites/www.mysite.example/dev-html/inc/inc/db_interface.php",
    0xFFFFFD7FFFDFD220) Err#2 ENOENT
    23485: open("/data/logs/httpd/error_log-php",
    O_WRONLY|O_APPEND|O_CREAT, 0666) = 17
    23485: lseek(17, 0, SEEK_END) = 14856
    23485: time() = 1171038559
    23485: fstat(17, 0xFFFFFD7FFFDFBAE0) = 0
    23485: brk(0x007D0C60) = 0
    23485: brk(0x007D4C60) = 0
    23485: fstat(17, 0xFFFFFD7FFFDFBA30) = 0
    23485: ioctl(17, TCGETA, 0xFFFFFD7FFFDFBAA0) Err#25 ENOTTY
    23485: write(17, " [ 0 9 - F e b - 2 0 0 7".., 241) = 241
    23485: close(17) = 0
    23485: open("/data/logs/httpd/error_log-php",
    O_WRONLY|O_APPEND|O_CREAT, 0666) = 17

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

    [2007-02-08 14:03:58] webtech at get-telecom dot fr

    What's up about this bug ?

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

    [2006-12-05 23:30:09] php dot net at ryanfindley dot com

    I forgot to mention that I tried the snapshot listed in the comment
    from 15 Nov 12:42pm UTC (PHP 5.2.1-dev), and experienced the same
    problem

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

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    [url]http://bugs.php.net/39351[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=39351&edit=1[/url]
    mail at unleadedonline dot net Guest

  14. #13

    Default #39351 [Opn]: require and include fails to open file in current directory

    ID: 39351
    Updated by: [email]tony2001@php.net[/email]
    Reported By: lampiluoto at gmail dot com
    Status: Open
    Bug Type: *Directory/Filesystem functions
    Operating System: Solaris10
    PHP Version: 5.2.0
    New Comment:
    >Anybody looking to fix this bug?
    No, we're unable to replicate it.
    If you have a Solaris10 handy - please provide an account with PHP,
    GDB, GCC and other utils required to reproduce and invesigate it.



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

    [2007-03-07 01:57:29] mail at unleadedonline dot net

    Anybody looking to fix this bug?

    We have the same setup as the original bug submitter, and can't upgrade
    from 5.1.6 to 5.2.1 because of this issue!

    It's a showstopper.

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

    [2007-02-27 20:27:11] mcmullent at gmail dot com

    Is there any chance you need to add:

    allow_url_include = On

    to your php.ini? My php.ini file (from a previous PHP5 release) did not
    have allow_url_include, and when I tried to upgrade from 5.1.6 to 5.2.x,
    I was getting similar errors. When I set allow_url_include, I was able
    to upgrade to 5.2.1 without any issues.

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

    [2007-02-23 10:28:08] webtech at get-telecom dot fr

    Is there a solution for this bug ?
    We're using PHP 5.1.6 and can't upgrade...

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

    [2007-02-09 16:54:55] lampiluoto at gmail dot com

    Hello,

    This bug seem to exist also in PHP 5.2.1, it
    is behaving similarly to the 5.2.0 snapshot I
    tested. This is same PHP code I tested earlier.

    I remind that this is situation where httpd user
    doesn't have read privilege to every directory
    level in path. It has only execute/access (x)
    to some of the directories.

    #
    # 5.1.6 truss output
    #
    24204: stat("./inc/config.php", 0xFFFFFD7FFFDFE470) = 0
    24204: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    24204: getcwd(0xFFFFFD7FFFDFD6F0, 1024) Err#13 EACCES
    [file_dac_read]
    24204: stat("./inc/config.php", 0xFFFFFD7FFFDFE390) = 0
    24204: getcwd(0xFFFFFD7FFFDFDFA0, 1024) Err#13 EACCES
    [file_dac_read]
    24204: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    24204: getcwd(0xFFFFFD7FFFDFD270, 1024) Err#13 EACCES
    [file_dac_read]
    24204: open("./inc/config.php", O_RDONLY) = 34
    24204: fstat(34, 0x007E4F90) = 0
    24204: lseek(34, 0, SEEK_CUR) = 0
    24204: read(34, " < ? p h p\n\n / / ".., 8192) = 1572
    24204: read(34, 0x007E27F8, 8192) = 0
    24204: read(34, 0x007E27F8, 8192) = 0
    24204: close(34) = 0
    24204: time() = 1171039558
    24204:
    resolvepath("/data/sites/www.lampiluoto.net/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    24204:
    stat("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    0xFFFFFD7FFFDFE360) = 0
    24204:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    24204:
    open("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    O_RDONLY) = 34
    24204: fstat(34, 0x007E5F10) = 0
    24204: lseek(34, 0, SEEK_CUR) = 0
    24204: read(34, " < ? p h p\n\n / /\n".., 8192) = 1171
    24204: read(34, 0x007E6C28, 8192) = 0
    24204: read(34, 0x007E6C28, 8192) = 0
    24204: brk(0x007E8F20) = 0
    24204: brk(0x007ECF20) = 0
    24204: brk(0x007ECF20) = 0
    24204: brk(0x007ECF20) = 0
    24204: brk(0x007F0F20) = 0
    24204: close(34) = 0
    24204: stat("./inc/db_interface.php", 0xFFFFFD7FFFDFD9C0) = 0
    24204: resolvepath("./inc/db_interface.php", "inc/db_interface.php",
    1024) = 20
    24204: getcwd(0xFFFFFD7FFFDFCC40, 1024) Err#13 EACCES
    [file_dac_read]
    24204: stat("./inc/db_interface.php", 0xFFFFFD7FFFDFD8E0) = 0
    24204: getcwd(0xFFFFFD7FFFDFD4F0, 1024) Err#13 EACCES
    [file_dac_read]
    24204: resolvepath("./inc/db_interface.php", "inc/db_interface.php",
    1024) = 20
    24204: getcwd(0xFFFFFD7FFFDFC7C0, 1024) Err#13 EACCES
    [file_dac_read]
    24204: open("./inc/db_interface.php", O_RDONLY) = 34
    24204: fstat(34, 0x007E2E30) = 0
    24204: lseek(34, 0, SEEK_CUR) = 0
    24204: read(34, " < ? p h p\n\n / /\n / /".., 8192) = 502
    24204: read(34, 0x007E6C28, 8192) = 0
    24204: read(34, 0x007E6C28, 8192) = 0
    24204: close(34) = 0


    #
    # 5.2.1 truss output
    #
    23485: stat("./inc/config.php", 0xFFFFFD7FFFDFE0D0) = 0
    23485: getcwd(0xFFFFFD7FFFDFD360, 1024) Err#13 EACCES
    [file_dac_read]
    23485: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    23485: getcwd(0xFFFFFD7FFFDFC660, 1024) Err#13 EACCES
    [file_dac_read]
    23485: stat("/inc/config.php", 0xFFFFFD7FFFDFDFF0) Err#2 ENOENT
    23485: stat("/opt/httpd/dev-installation/php5/lib/php/inc/config.php",
    0xFFFFFD7FFFDFE0D0) Err#2 ENOENT
    23485: stat("/data/sites/www.mysite.example/dev-html/inc/config.php",
    0xFFFFFD7FFFDFE0D0) = 0
    23485:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/config.php",
    "/data/sites/www.mysite.example/dev-html/inc/config.php", 1024) = 54
    23485: stat("/data/sites/www.mysite.example/dev-html/inc/config.php",
    0xFFFFFD7FFFDFDFF0) = 0
    23485:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/config.php",
    "/data/sites/www.mysite.example/dev-html/inc/config.php", 1024) = 54
    23485: open("/data/sites/www.mysite.example/dev-html/inc/config.php",
    O_RDONLY) = 17
    23485: fstat(17, 0x005D0778) = 0
    23485: read(17, " < ? p h p\n\n / / ".., 8192) = 1572
    23485: read(17, 0x005D0A20, 8192) = 0
    23485: close(17) = 0
    23485: time() = 1171038559
    23485:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    23485:
    stat("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    0xFFFFFD7FFFDFDFC0) = 0
    23485:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    23485:
    open("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    O_RDONLY) = 17
    23485: fstat(17, 0x005D0778) = 0
    23485: read(17, " < ? p h p\n\n / /\n".., 8192) = 1171
    23485: read(17, 0x005D4D10, 8192) = 0
    23485: close(17) = 0
    23485: stat("./inc/db_interface.php", 0xFFFFFD7FFFDFD220) = 0
    23485: getcwd(0xFFFFFD7FFFDFC4B0, 1024) Err#13 EACCES
    [file_dac_read]
    23485: resolvepath("./inc/db_interface.php", "inc/db_interface.php",
    1024) = 20
    23485: getcwd(0xFFFFFD7FFFDFB7B0, 1024) Err#13 EACCES
    [file_dac_read]
    23485: stat("/inc/db_interface.php", 0xFFFFFD7FFFDFD140) Err#2 ENOENT
    23485:
    stat("/opt/httpd/dev-installation/php5/lib/php/inc/db_interface.php",
    0xFFFFFD7FFFDFD220) Err#2 ENOENT
    23485:
    stat("/data/sites/www.mysite.example/dev-html/inc/inc/db_interface.php",
    0xFFFFFD7FFFDFD220) Err#2 ENOENT
    23485: open("/data/logs/httpd/error_log-php",
    O_WRONLY|O_APPEND|O_CREAT, 0666) = 17
    23485: lseek(17, 0, SEEK_END) = 14856
    23485: time() = 1171038559
    23485: fstat(17, 0xFFFFFD7FFFDFBAE0) = 0
    23485: brk(0x007D0C60) = 0
    23485: brk(0x007D4C60) = 0
    23485: fstat(17, 0xFFFFFD7FFFDFBA30) = 0
    23485: ioctl(17, TCGETA, 0xFFFFFD7FFFDFBAA0) Err#25 ENOTTY
    23485: write(17, " [ 0 9 - F e b - 2 0 0 7".., 241) = 241
    23485: close(17) = 0
    23485: open("/data/logs/httpd/error_log-php",
    O_WRONLY|O_APPEND|O_CREAT, 0666) = 17

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

    [2007-02-08 14:03:58] webtech at get-telecom dot fr

    What's up about this bug ?

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

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    [url]http://bugs.php.net/39351[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=39351&edit=1[/url]
    tony2001@php.net Guest

  15. #14

    Default #39351 [Opn]: require and include fails to open file in current directory

    ID: 39351
    User updated by: lampiluoto at gmail dot com
    Reported By: lampiluoto at gmail dot com
    Status: Open
    Bug Type: *Directory/Filesystem functions
    Operating System: Solaris10
    PHP Version: 5.2.0
    New Comment:

    Hi,

    I emailed with Tony about providing
    Sol10 environment for reproducing the
    problem and debugging it.

    --
    Tero


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

    [2007-03-07 07:38:42] [email]tony2001@php.net[/email]
    >Anybody looking to fix this bug?
    No, we're unable to replicate it.
    If you have a Solaris10 handy - please provide an account with PHP,
    GDB, GCC and other utils required to reproduce and invesigate it.


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

    [2007-03-07 01:57:29] mail at unleadedonline dot net

    Anybody looking to fix this bug?

    We have the same setup as the original bug submitter, and can't upgrade
    from 5.1.6 to 5.2.1 because of this issue!

    It's a showstopper.

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

    [2007-02-27 20:27:11] mcmullent at gmail dot com

    Is there any chance you need to add:

    allow_url_include = On

    to your php.ini? My php.ini file (from a previous PHP5 release) did not
    have allow_url_include, and when I tried to upgrade from 5.1.6 to 5.2.x,
    I was getting similar errors. When I set allow_url_include, I was able
    to upgrade to 5.2.1 without any issues.

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

    [2007-02-23 10:28:08] webtech at get-telecom dot fr

    Is there a solution for this bug ?
    We're using PHP 5.1.6 and can't upgrade...

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

    [2007-02-09 16:54:55] lampiluoto at gmail dot com

    Hello,

    This bug seem to exist also in PHP 5.2.1, it
    is behaving similarly to the 5.2.0 snapshot I
    tested. This is same PHP code I tested earlier.

    I remind that this is situation where httpd user
    doesn't have read privilege to every directory
    level in path. It has only execute/access (x)
    to some of the directories.

    #
    # 5.1.6 truss output
    #
    24204: stat("./inc/config.php", 0xFFFFFD7FFFDFE470) = 0
    24204: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    24204: getcwd(0xFFFFFD7FFFDFD6F0, 1024) Err#13 EACCES
    [file_dac_read]
    24204: stat("./inc/config.php", 0xFFFFFD7FFFDFE390) = 0
    24204: getcwd(0xFFFFFD7FFFDFDFA0, 1024) Err#13 EACCES
    [file_dac_read]
    24204: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    24204: getcwd(0xFFFFFD7FFFDFD270, 1024) Err#13 EACCES
    [file_dac_read]
    24204: open("./inc/config.php", O_RDONLY) = 34
    24204: fstat(34, 0x007E4F90) = 0
    24204: lseek(34, 0, SEEK_CUR) = 0
    24204: read(34, " < ? p h p\n\n / / ".., 8192) = 1572
    24204: read(34, 0x007E27F8, 8192) = 0
    24204: read(34, 0x007E27F8, 8192) = 0
    24204: close(34) = 0
    24204: time() = 1171039558
    24204:
    resolvepath("/data/sites/www.lampiluoto.net/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    24204:
    stat("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    0xFFFFFD7FFFDFE360) = 0
    24204:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    24204:
    open("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    O_RDONLY) = 34
    24204: fstat(34, 0x007E5F10) = 0
    24204: lseek(34, 0, SEEK_CUR) = 0
    24204: read(34, " < ? p h p\n\n / /\n".., 8192) = 1171
    24204: read(34, 0x007E6C28, 8192) = 0
    24204: read(34, 0x007E6C28, 8192) = 0
    24204: brk(0x007E8F20) = 0
    24204: brk(0x007ECF20) = 0
    24204: brk(0x007ECF20) = 0
    24204: brk(0x007ECF20) = 0
    24204: brk(0x007F0F20) = 0
    24204: close(34) = 0
    24204: stat("./inc/db_interface.php", 0xFFFFFD7FFFDFD9C0) = 0
    24204: resolvepath("./inc/db_interface.php", "inc/db_interface.php",
    1024) = 20
    24204: getcwd(0xFFFFFD7FFFDFCC40, 1024) Err#13 EACCES
    [file_dac_read]
    24204: stat("./inc/db_interface.php", 0xFFFFFD7FFFDFD8E0) = 0
    24204: getcwd(0xFFFFFD7FFFDFD4F0, 1024) Err#13 EACCES
    [file_dac_read]
    24204: resolvepath("./inc/db_interface.php", "inc/db_interface.php",
    1024) = 20
    24204: getcwd(0xFFFFFD7FFFDFC7C0, 1024) Err#13 EACCES
    [file_dac_read]
    24204: open("./inc/db_interface.php", O_RDONLY) = 34
    24204: fstat(34, 0x007E2E30) = 0
    24204: lseek(34, 0, SEEK_CUR) = 0
    24204: read(34, " < ? p h p\n\n / /\n / /".., 8192) = 502
    24204: read(34, 0x007E6C28, 8192) = 0
    24204: read(34, 0x007E6C28, 8192) = 0
    24204: close(34) = 0


    #
    # 5.2.1 truss output
    #
    23485: stat("./inc/config.php", 0xFFFFFD7FFFDFE0D0) = 0
    23485: getcwd(0xFFFFFD7FFFDFD360, 1024) Err#13 EACCES
    [file_dac_read]
    23485: resolvepath("./inc/config.php", "inc/config.php", 1024) = 14
    23485: getcwd(0xFFFFFD7FFFDFC660, 1024) Err#13 EACCES
    [file_dac_read]
    23485: stat("/inc/config.php", 0xFFFFFD7FFFDFDFF0) Err#2 ENOENT
    23485: stat("/opt/httpd/dev-installation/php5/lib/php/inc/config.php",
    0xFFFFFD7FFFDFE0D0) Err#2 ENOENT
    23485: stat("/data/sites/www.mysite.example/dev-html/inc/config.php",
    0xFFFFFD7FFFDFE0D0) = 0
    23485:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/config.php",
    "/data/sites/www.mysite.example/dev-html/inc/config.php", 1024) = 54
    23485: stat("/data/sites/www.mysite.example/dev-html/inc/config.php",
    0xFFFFFD7FFFDFDFF0) = 0
    23485:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/config.php",
    "/data/sites/www.mysite.example/dev-html/inc/config.php", 1024) = 54
    23485: open("/data/sites/www.mysite.example/dev-html/inc/config.php",
    O_RDONLY) = 17
    23485: fstat(17, 0x005D0778) = 0
    23485: read(17, " < ? p h p\n\n / / ".., 8192) = 1572
    23485: read(17, 0x005D0A20, 8192) = 0
    23485: close(17) = 0
    23485: time() = 1171038559
    23485:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    23485:
    stat("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    0xFFFFFD7FFFDFDFC0) = 0
    23485:
    resolvepath("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    "/data/sites/www.mysite.example/dev-html/inc/func_prepare.php", 1024) =
    60
    23485:
    open("/data/sites/www.mysite.example/dev-html/inc/func_prepare.php",
    O_RDONLY) = 17
    23485: fstat(17, 0x005D0778) = 0
    23485: read(17, " < ? p h p\n\n / /\n".., 8192) = 1171
    23485: read(17, 0x005D4D10, 8192) = 0
    23485: close(17) = 0
    23485: stat("./inc/db_interface.php", 0xFFFFFD7FFFDFD220) = 0
    23485: getcwd(0xFFFFFD7FFFDFC4B0, 1024) Err#13 EACCES
    [file_dac_read]
    23485: resolvepath("./inc/db_interface.php", "inc/db_interface.php",
    1024) = 20
    23485: getcwd(0xFFFFFD7FFFDFB7B0, 1024) Err#13 EACCES
    [file_dac_read]
    23485: stat("/inc/db_interface.php", 0xFFFFFD7FFFDFD140) Err#2 ENOENT
    23485:
    stat("/opt/httpd/dev-installation/php5/lib/php/inc/db_interface.php",
    0xFFFFFD7FFFDFD220) Err#2 ENOENT
    23485:
    stat("/data/sites/www.mysite.example/dev-html/inc/inc/db_interface.php",
    0xFFFFFD7FFFDFD220) Err#2 ENOENT
    23485: open("/data/logs/httpd/error_log-php",
    O_WRONLY|O_APPEND|O_CREAT, 0666) = 17
    23485: lseek(17, 0, SEEK_END) = 14856
    23485: time() = 1171038559
    23485: fstat(17, 0xFFFFFD7FFFDFBAE0) = 0
    23485: brk(0x007D0C60) = 0
    23485: brk(0x007D4C60) = 0
    23485: fstat(17, 0xFFFFFD7FFFDFBA30) = 0
    23485: ioctl(17, TCGETA, 0xFFFFFD7FFFDFBAA0) Err#25 ENOTTY
    23485: write(17, " [ 0 9 - F e b - 2 0 0 7".., 241) = 241
    23485: close(17) = 0
    23485: open("/data/logs/httpd/error_log-php",
    O_WRONLY|O_APPEND|O_CREAT, 0666) = 17

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

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    [url]http://bugs.php.net/39351[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=39351&edit=1[/url]
    lampiluoto at gmail dot com Guest

  16. #15

    Default #39351 [Com]: require and include fails to open file in current directory

    ID: 39351
    Comment by: webtech at get-telecom dot fr
    Reported By: lampiluoto at gmail dot com
    Status: Open
    Bug Type: *Directory/Filesystem functions
    Operating System: Solaris10
    PHP Version: 5.2.0
    New Comment:

    I've tried with "allow_url_include = On",
    but with PHP 5.2.1, I've the same include problem.


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

    [2007-03-10 13:22:44] lampiluoto at gmail dot com

    Hi,

    I emailed with Tony about providing
    Sol10 environment for reproducing the
    problem and debugging it.

    --
    Tero

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

    [2007-03-07 07:38:42] [email]tony2001@php.net[/email]
    >Anybody looking to fix this bug?
    No, we're unable to replicate it.
    If you have a Solaris10 handy - please provide an account with PHP,
    GDB, GCC and other utils required to reproduce and invesigate it.


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

    [2007-03-07 01:57:29] mail at unleadedonline dot net

    Anybody looking to fix this bug?

    We have the same setup as the original bug submitter, and can't upgrade
    from 5.1.6 to 5.2.1 because of this issue!

    It's a showstopper.

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

    [2007-02-27 20:27:11] mcmullent at gmail dot com

    Is there any chance you need to add:

    allow_url_include = On

    to your php.ini? My php.ini file (from a previous PHP5 release) did not
    have allow_url_include, and when I tried to upgrade from 5.1.6 to 5.2.x,
    I was getting similar errors. When I set allow_url_include, I was able
    to upgrade to 5.2.1 without any issues.

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

    [2007-02-23 10:28:08] webtech at get-telecom dot fr

    Is there a solution for this bug ?
    We're using PHP 5.1.6 and can't upgrade...

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

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    [url]http://bugs.php.net/39351[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=39351&edit=1[/url]
    webtech at get-telecom dot fr Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139