Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 12-23-2005, 01:00 PM   #1
LQ Newbie
Registered: Dec 2005
Posts: 1

Rep: Reputation: 0
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!
Old 12-23-2005, 10:22 PM   #2
Senior Member
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,284

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Linking Libraries, Dependencies Killbot_5000 Linux - Software 4 09-28-2004 09:59 AM
Symbolic linking directories leecming Linux - General 1 06-08-2004 12:11 PM
symbolic linking dvd-rom to /dev/dvd ? Falcon006 Linux - Newbie 3 03-20-2004 01:57 AM
symbolic linking directories? Possible? ajspliffs Linux - General 3 01-12-2004 12:55 PM
symbolic linking ???? salparadise Linux - Newbie 2 12-26-2002 01:01 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:43 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration