Welcome to WebmasterWorld Guest from 35.171.146.16

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Include file from different account on same server

How can I include a file from a different account on my server?

     
7:57 pm on Jun 22, 2011 (gmt 0)

Junior Member

10+ Year Member Top Contributors Of The Month

joined:May 20, 2005
posts: 175
votes: 2


Hey there,

I am running a vps box with a few different accounts set up. I own them all, so I have full access to permissions and such, my question is this.

How can I include a file from a different account on my box?

I tried doing this method:

<?php include ('/home/account1/public_html/includes/file.txt') ?>


But get an error message because I'm trying to do it from /home/account2

How would I go about making a global include file?

Thank you!
8:24 pm on June 22, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member penders is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2006
posts: 3146
votes: 3


If URL_fopen_wrappers are enabled then you could perhaps do:
<?php include ('http://example.com/includes/file.txt') ?>


However, this is different to including a 'local' file. The file is processed at the 'remote' server. See PHP Manual: include() [uk3.php.net].
8:43 pm on June 22, 2011 (gmt 0)

Junior Member

10+ Year Member Top Contributors Of The Month

joined:May 20, 2005
posts: 175
votes: 2


Yea, right now I'm using file_get_contents which essentially does the same thing. I was trying to find a way to skip the remote calls.
9:35 pm on June 22, 2011 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member 10+ Year Member

joined:Aug 28, 2002
posts:994
votes: 2


nope...there's no real way to skip the remote calls as both accounts are seen as completely separate servers. Allowing calls between accounts like that locally would open up some big-time security issues.
9:38 pm on June 22, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member penders is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2006
posts: 3146
votes: 3


Can you modify the include_path - perhaps in php.ini? - actually I think that will just be the same as directly specifying the path in include()?

If you specify the appropriate path to the other account, what error do you get? A permissions problem?

There must be a way to relax the perms between accounts - I would have thought?! This is beginning to sound more like an Apache server config issue rather than PHP? But I'm guessing now.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members