Welcome to WebmasterWorld Guest from 54.162.155.183

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)

10+ Year Member



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 Jun 22, 2011 (gmt 0)

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



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 Jun 22, 2011 (gmt 0)

10+ Year Member



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 Jun 22, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



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 Jun 22, 2011 (gmt 0)

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



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.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month