#9673 [Com]: Relative paths in require(), require_once(), include(), include_once()
ID: 9673 Comment by: php at mrvanes dot com Reported By: vvo at geocities dot com Status: Bogus Bug Type: Scripting Engine problem Operating System: RedHat Linux PHP Version: 4.3.2 New Comment: I too second that it would be logical to have the path relative to the _current_ file we're looking at, no matter how deep it is included in other files. Relativity makes absolute _no_ sense without this. Previous Comments: [2004-06-10 17:31:54] vvo at geocities dot com That's ok, I gave up on PHP a long time ago. RTFPHPM yourself. [2004-04-20 06:21:34] cameron at prolifique dot com No, not necessarily a bug...just a very illogical and painful behavior for the include require functions when using relative paths. It's like having a compass that points north in relation to wherever you started your trip, not where you're standing now. Not much use. If you knew where you started, why would you need a compass? If a relative include path isn't relative to the script calling it, what's the use of a relative include path? I never expected that the hardest part of moving from ASP to PHP would be include file references, but considering this behavior (still happening in 4.3.4), it appears to be. Luckily, there appears to be a workaround: [2 Sep 2003 8:48am CEST] mathieu dot messe at urssaf dot fr A workaround found at http://fr.php.net/manual/fr/function.include.php is to use require(dirname(__FILE__) . \..\second.php); [2004-04-05 08:50:44] [EMAIL PROTECTED] RTFM. There is no bug here. [2004-04-02 16:03:57] chapwest at hotmail dot com I have no idea what this means in regard to my sight. Michael [2004-04-01 18:36:07] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip 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 http://bugs.php.net/9673 -- Edit this bug report at http://bugs.php.net/?id=9673edit=1
#9673 [Com]: Relative paths in require(), require_once(), include(), include_once()
ID: 9673 Comment by: cameron at prolifique dot com Reported By: vvo at geocities dot com Status: Bogus Bug Type: Scripting Engine problem Operating System: RedHat Linux PHP Version: 4.3.2 New Comment: No, not necessarily a bug...just a very illogical and painful behavior for the include require functions when using relative paths. It's like having a compass that points north in relation to wherever you started your trip, not where you're standing now. Not much use. If you knew where you started, why would you need a compass? If a relative include path isn't relative to the script calling it, what's the use of a relative include path? I never expected that the hardest part of moving from ASP to PHP would be include file references, but considering this behavior (still happening in 4.3.4), it appears to be. Luckily, there appears to be a workaround: [2 Sep 2003 8:48am CEST] mathieu dot messe at urssaf dot fr A workaround found at http://fr.php.net/manual/fr/function.include.php is to use require(dirname(__FILE__) . \..\second.php); Previous Comments: [2004-04-05 08:50:44] [EMAIL PROTECTED] RTFM. There is no bug here. [2004-04-02 16:03:57] chapwest at hotmail dot com I have no idea what this means in regard to my sight. Michael [2004-04-01 18:36:07] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip [2004-04-01 18:32:42] vvo at geocities dot com setting version to 4.3.2 [2004-04-01 18:31:04] vvo at geocities dot com Not clear to me why the issue status was changed to Bogus. As far as I can tell multiple people have same issue. 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 http://bugs.php.net/9673 -- Edit this bug report at http://bugs.php.net/?id=9673edit=1
#9673 [Com]: Relative paths in require(), require_once(), include(), include_once()
ID: 9673 Comment by: chapwest at hotmail dot com Reported By: vvo at geocities dot com Status: Feedback Bug Type: Scripting Engine problem Operating System: RedHat Linux PHP Version: 4.3.2 New Comment: I have no idea what this means in regard to my sight. Michael Previous Comments: [2004-04-01 18:36:07] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip [2004-04-01 18:32:42] vvo at geocities dot com setting version to 4.3.2 [2004-04-01 18:31:04] vvo at geocities dot com Not clear to me why the issue status was changed to Bogus. As far as I can tell multiple people have same issue. [2004-03-24 15:14:47] chunan at zingy dot com I am also having problems with the include() function. I also agree that relative includes should always be relative to the current script. [2004-03-18 17:51:28] schapht at drexel dot edu I am using version 4.3.2, and I have this problem. I also agree that the php include behavior hurts modularity. I can't reuse classes w/o modifying the code to handle the new parent-script path. Please tell me there's a fix for this. 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 http://bugs.php.net/9673 -- Edit this bug report at http://bugs.php.net/?id=9673edit=1
#9673 [Com]: Relative paths in require(), require_once(), include(), include_once()
ID: 9673 Comment by: chunan at zingy dot com Reported By: vvo at geocities dot com Status: Bogus Bug Type: Scripting Engine problem Operating System: RedHat Linux 7.1 PHP Version: 4.1.1 New Comment: I am also having problems with the include() function. I also agree that relative includes should always be relative to the current script. Previous Comments: [2004-03-18 17:51:28] schapht at drexel dot edu I am using version 4.3.2, and I have this problem. I also agree that the php include behavior hurts modularity. I can't reuse classes w/o modifying the code to handle the new parent-script path. Please tell me there's a fix for this. [2004-01-13 09:57:57] php at arantius dot cjb dot net I'm sure I can get around this, but things really would be nice if this worked. Situation is a very modular web site, with many files to be included, some class definitions, and some other fuctions. Off of the root /, there is /classes and /plugins . A file in /plugins is included from a file in /, and depends on a file in /classes. In other words: /main.php includes /plugin/driver.php /plugin/driver.php includes /classes/Item.php But, within /plugin/driver.php, the statement require_once ../classes/Item.php fails. [2002-06-07 20:36:57] [EMAIL PROTECTED] Thank you for taking the time to report a problem with PHP. Unfortunately your version of PHP is too old -- the problem might already be fixed. Please download a new PHP version from http://www.php.net/downloads.php If you are able to reproduce the bug with one of the latest versions of PHP, please change the PHP version on this bug report to the version you tested and change the status back to Open. Again, thank you for your continued support of PHP. [2002-03-05 00:33:02] vvo at geocities dot com I was happy for awhile, but eventually I noticed a problem with *some* relative paths (in version 4.1.1). Say, there is the main script 'test.php' and two other files, 'a.inc' and 'b.inc' (in subdirs): File './test.php': ?php require_once( 'include/a/a.inc' ); ? File './include/a/a.inc': ?php require_once( '../b.inc' ); echo 'a.inc '; ? File './include/b.inc': ?php echo 'b.inc '; ? Running 'test.php' fails with: Fatal error: Failed opening required '../b.inc' (include_path='.:/usr/local/lib/php') in /home/geeba/include/a/a.inc on line 2 This isn't intended, is it? Thank you! [2001-07-16 12:07:02] [EMAIL PROTECTED] include() (and the other functions in its family) will now also look in the current executing file's directory, so this issue should be resolved. 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 http://bugs.php.net/9673 -- Edit this bug report at http://bugs.php.net/?id=9673edit=1
#9673 [Com]: Relative paths in require(), require_once(), include(), include_once()
ID: 9673 Comment by: schapht at drexel dot edu Reported By: vvo at geocities dot com Status: Bogus Bug Type: Scripting Engine problem Operating System: RedHat Linux 7.1 PHP Version: 4.1.1 New Comment: I am using version 4.3.2, and I have this problem. I also agree that the php include behavior hurts modularity. I can't reuse classes w/o modifying the code to handle the new parent-script path. Please tell me there's a fix for this. Previous Comments: [2004-01-13 09:57:57] php at arantius dot cjb dot net I'm sure I can get around this, but things really would be nice if this worked. Situation is a very modular web site, with many files to be included, some class definitions, and some other fuctions. Off of the root /, there is /classes and /plugins . A file in /plugins is included from a file in /, and depends on a file in /classes. In other words: /main.php includes /plugin/driver.php /plugin/driver.php includes /classes/Item.php But, within /plugin/driver.php, the statement require_once ../classes/Item.php fails. [2002-06-07 20:36:57] [EMAIL PROTECTED] Thank you for taking the time to report a problem with PHP. Unfortunately your version of PHP is too old -- the problem might already be fixed. Please download a new PHP version from http://www.php.net/downloads.php If you are able to reproduce the bug with one of the latest versions of PHP, please change the PHP version on this bug report to the version you tested and change the status back to Open. Again, thank you for your continued support of PHP. [2002-03-05 00:33:02] vvo at geocities dot com I was happy for awhile, but eventually I noticed a problem with *some* relative paths (in version 4.1.1). Say, there is the main script 'test.php' and two other files, 'a.inc' and 'b.inc' (in subdirs): File './test.php': ?php require_once( 'include/a/a.inc' ); ? File './include/a/a.inc': ?php require_once( '../b.inc' ); echo 'a.inc '; ? File './include/b.inc': ?php echo 'b.inc '; ? Running 'test.php' fails with: Fatal error: Failed opening required '../b.inc' (include_path='.:/usr/local/lib/php') in /home/geeba/include/a/a.inc on line 2 This isn't intended, is it? Thank you! [2001-07-16 12:07:02] [EMAIL PROTECTED] include() (and the other functions in its family) will now also look in the current executing file's directory, so this issue should be resolved. [2001-03-15 10:09:07] vvo at geocities dot com We are talking about all four functions here, not just include(). The resemblance of require() to the #include directive, as documented: quoteThe require() statement replaces itself with the specified file, much like the C preprocessor's #include works./quote If it's a known issue, are there any plans to fix it? Thanks. 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 http://bugs.php.net/9673 -- Edit this bug report at http://bugs.php.net/?id=9673edit=1
#9673 [Com]: Relative paths in require(), require_once(), include(), include_once()
ID: 9673 Comment by: php at arantius dot cjb dot net Reported By: vvo at geocities dot com Status: Bogus Bug Type: Scripting Engine problem Operating System: RedHat Linux 7.1 PHP Version: 4.1.1 New Comment: I'm sure I can get around this, but things really would be nice if this worked. Situation is a very modular web site, with many files to be included, some class definitions, and some other fuctions. Off of the root /, there is /classes and /plugins . A file in /plugins is included from a file in /, and depends on a file in /classes. In other words: /main.php includes /plugin/driver.php /plugin/driver.php includes /classes/Item.php But, within /plugin/driver.php, the statement require_once ../classes/Item.php fails. Previous Comments: [2002-06-07 20:36:57] [EMAIL PROTECTED] Thank you for taking the time to report a problem with PHP. Unfortunately your version of PHP is too old -- the problem might already be fixed. Please download a new PHP version from http://www.php.net/downloads.php If you are able to reproduce the bug with one of the latest versions of PHP, please change the PHP version on this bug report to the version you tested and change the status back to Open. Again, thank you for your continued support of PHP. [2002-03-05 00:33:02] vvo at geocities dot com I was happy for awhile, but eventually I noticed a problem with *some* relative paths (in version 4.1.1). Say, there is the main script 'test.php' and two other files, 'a.inc' and 'b.inc' (in subdirs): File './test.php': ?php require_once( 'include/a/a.inc' ); ? File './include/a/a.inc': ?php require_once( '../b.inc' ); echo 'a.inc '; ? File './include/b.inc': ?php echo 'b.inc '; ? Running 'test.php' fails with: Fatal error: Failed opening required '../b.inc' (include_path='.:/usr/local/lib/php') in /home/geeba/include/a/a.inc on line 2 This isn't intended, is it? Thank you! [2001-07-16 12:07:02] [EMAIL PROTECTED] include() (and the other functions in its family) will now also look in the current executing file's directory, so this issue should be resolved. [2001-03-15 10:09:07] vvo at geocities dot com We are talking about all four functions here, not just include(). The resemblance of require() to the #include directive, as documented: quoteThe require() statement replaces itself with the specified file, much like the C preprocessor's #include works./quote If it's a known issue, are there any plans to fix it? Thanks. [2001-03-15 09:08:11] [EMAIL PROTECTED] First, PHP include() is in no way related or was promised to relate to C preprocessor directives, so no wonder it behaves differently. Now, all relative pathes are resolved against the current directory of the including script (which is the directory where it's located). This is a known issue. Use include_pathes in the meantime. 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 http://bugs.php.net/9673 -- Edit this bug report at http://bugs.php.net/?id=9673edit=1