homepage Welcome to WebmasterWorld Guest from 54.204.77.26
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

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




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

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!

 

penders




msg:4329592
 8:24 pm on Jun 22, 2011 (gmt 0)

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].

vanillaice




msg:4329599
 8:43 pm on Jun 22, 2011 (gmt 0)

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.

Philosopher




msg:4329618
 9:35 pm on Jun 22, 2011 (gmt 0)

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.

penders




msg:4329620
 9:38 pm on Jun 22, 2011 (gmt 0)

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved