Pioden Posted July 2, 2008 Share Posted July 2, 2008 I need some help with a problem. Lets say I have 5 users. They all have their own home directories BUT they need to share common files which are stored by user 6 ... Easy. Symbolic link from each user to the relevant directory owned by user 6. Tested and working :-) Where it all goes wrong is the next step. Every user has their own config.php file stored in their home directory. The common files need to access each users individual config file in order to access database settings. But how? ../config.php or similar simply references the files in user 6'd home directory. Can you see what I'm getting at? I need a way to php to dynamically reference the config file in the correct home directory. All suggestions welcome - this one is doing my head in!!! Quote Link to comment https://forums.phpfreaks.com/topic/112949-interesting-symbolic-link-issue/ Share on other sites More sharing options...
trq Posted July 2, 2008 Share Posted July 2, 2008 Is this for use in a cli application or something running via Apache? If its for the cli, the $_ENV array might help you out, $_ENV['HOME'] specifically. Quote Link to comment https://forums.phpfreaks.com/topic/112949-interesting-symbolic-link-issue/#findComment-580200 Share on other sites More sharing options...
Pioden Posted July 2, 2008 Author Share Posted July 2, 2008 Apache. I'll look into $_ENV anyway. It's not something I've used before. I'll get back to you :-) Thanks Huw Quote Link to comment https://forums.phpfreaks.com/topic/112949-interesting-symbolic-link-issue/#findComment-580476 Share on other sites More sharing options...
trq Posted July 3, 2008 Share Posted July 3, 2008 The $_ENV array will be of little use to use in this case because apache runs under its own user. The common files need to access each users individual config file in order to access database settings. But how? Sounds like you are creating some type of framework (the shared files) which can run multiple sites (based on settings in a users $HOME directory). How are you determining which user is accessing the site? Eg; My framework works much the same, the core of it is stored within /usr/share/php5, while each site is within /var/www/sitename. However, each of my sites runs under a different vhost so it is simple to find out which config file (/var/www/sitename/etc/config.php) to execute based on the domain name within the url. Maybe you could do something similar? Quote Link to comment https://forums.phpfreaks.com/topic/112949-interesting-symbolic-link-issue/#findComment-580568 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.