LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how does file dependencies work with symbolic linking? (https://www.linuxquestions.org/questions/linux-newbie-8/how-does-file-dependencies-work-with-symbolic-linking-395952/)

bulletck 12-23-2005 12:00 PM

how does file dependencies work with symbolic linking?
 
Here is the set-up I have:

a directory called /blah
a directory called /blah/etc
an index.php file in /blah/etc where there is a require statement like so require("../file.php");

i have another directory called /sym and in there i create a symbolic link from /sym/etc to /blah/etc

when i try to visit /sym/etc in a browser it basically redirects me to /blah/etc and includes blah's file.php instead of reading sym's file.php.

How can I set things up so that /sym directory will try to find files relative to itself first and if it cant then read the file from /blah directory? So in /sym/etc/index.php there is a require for ../file.php and if it finds file.php in the root of /sym then it will read that file and if not then it will read /blah/file.php. Does this make any sense? Thanks in advance!

btmiller 12-23-2005 09:22 PM

If I understand you correctly, I don't think there's an easy way to do what you want. If you're in /sym/etc, then the parent directory is sym and it doesn't know anything about /blah. You could write a little routine in PHP to use the stat function to check if /sym/etc is a symlink, and if so check ehatever it points to for required files.


All times are GMT -5. The time now is 03:21 AM.