php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33870 relative include from symbolic linked file
Submitted: 2005-07-26 17:39 UTC Modified: 2005-07-26 17:51 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: jtaal at eljakm dot nl Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4.3.11 OS: linux
Private report: No CVE-ID: None
 [2005-07-26 17:39 UTC] jtaal at eljakm dot nl
Description:
------------
On my development server I have a directory:
/var/www/app
containing the file:
menu.inc
dbsettings.inc
and the symbolic links
db_mysql.inc -> /var/export/db_mysql.inc
subdir -> /var/export/subdir

In the directory /var/export:
db_mysql.inc
In the directory /var/export/subdir:
include.inc

The file db_mysql.inc has the following line:
require_once("dbsettings.inc");
The file include.inc has the following line:
require_once("../menu.inc");

What happens is that the include_path is ".", so the file ../menu.inc cannot be found by include.inc

I tried to set the include_path to /var/www/app. This worked for the file db_mysql.inc, but it didn't work for menu.inc. I tried to set the include path to ".:/var/www/app", but then the file dbsettings.inc couldn't be found.
I also tried "/var/www/app:/var/www/app/subdir" and lots of other combinations.

On a release server the two directories are merged so there will be no symlinks. (The problem I have does not occur on this server)


I googled lots of hours, but didn't find any thing useful.
I expected PHP to open the symlinked files as if they were actually there.
Can I configure PHP to do so?

Reproduce code:
---------------
/var/export/db_mysql.inc:
require_once('dbsettings.inc');

/var/export/subdir/include.inc:
require_once('../menu.inc');

/var/www/app/menu.inc:
$menu = array( ... );

/var/www/app/dbsettings.inc:
$host = 'localhost';
$user = '...';
...

symlinks:
/var/www/app/db_mysql.inc -> /var/export/db_mysql.inc
/var/www/app/subdir -> /var/export/subdir

Expected result:
----------------
I expected PHP to open the symlinked files as if they were actually there.


Actual result:
--------------
Warning: main(../menu.inc): failed to open stream: No such file or directory in /var/export/subdir/include.inc on line 4

Fatal error: main(): Failed opening required '../menu.inc' (include_path='/var/www/app') in /var/export/subdir/include.inc on line 4


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-26 17:51 UTC] tony2001@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 11:00:02 2026 UTC