Usernames


#1

if i create a PHP script that includes files, can it include files from a different username on the same server?

ex.
the php file is located here:
/home/usernameX/domain1.com/program.com

in this php file, there is an include("/home/usernameY/domain2.com/somefile.inc.php")

or is it blocked for security reasons?


#2

If your users are from the same webid, or to say in another way, if all users are on the same group, you can read, and therefore, do include with others users path (as long as are on the same group, if you have created both users and done no more, I think that these is the standar permisions… you can do more thinks with groups and group premissions on the web panel)

But the include itself is gona to give you an error…
of fopen
http://wiki.dreamhost.com/index.php/Allow_url_fopen

You need to change a little your include… citing from above

Server-Side Includes

Many developers include files by pointing to a remote URL, even if the file is within the local system. For example:

<?php include("http://example.com/includes/example_include.php"); ?>

With allow_url_fopen disabled, this method will not work. Instead, the file must be included with a local path, and there are three methods of doing this:

  1. By using a relative path, such as …/includes/example_include.php.
  2. By using an absolute path (also known as relative-from-root), such as /home/username/example.com/includes/example_include.php.
  3. By using the PHP environment variable $_SERVER[‘DOCUMENT_ROOT’], which returns the absolute path to the web root directory. This is by far the best (and most portable) solution. The example that follows shows the environment variable in action:

[edit]
Example Include

<?php include($_SERVER['DOCUMENT_ROOT']."/includes/example_include.php"); ?>

#3

so as long as i use /home/username/etc… i’ll be okay looks like