1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

php include from subdomains

Discussion in 'Plesk for Linux - 8.x and Older' started by path2u, Sep 12, 2006.

  1. path2u

    path2u Guest

    0
     
    I am hoping someone can assist me with this. I have a dedicated server running around 10 domains. I have one primary domain, running a few subdomains under it as well. The issue I am having is, I want to create a standard set of headers and footers, and use php include statements to use them from the subdomains as well. I have tried all sorts of different configurations and methods of calling the paths, but I can not seem to get the include statements to function from the subdomains. For example, I have header file in mainsite.com/includes which I want to use as header on subdomain.mainsite.com
    Is there some limitation on the subdomains by deafault, or is there a setting in the separate config files which can turn this on and off ?
    any help would be wonderful,
    thanks,
    Jesse Goodman
     
  2. pedropadron

    pedropadron Guest

    0
     
    maybe you're having permission problems.
    what kind of error message do you get when you try to include the file?

    if your subdomain is not using the same ftp user as your domain, you won't be able to include the file because the owner is different. you can change the file permissions to make it work, like executing a chmod 777 domain.com/includes/header.inc.php for example. just change 777 to any other permission that you prefer.

    you may also want to check the php open_basedir restriction and safe_mode on the file domain.com/subdomains/subdomain/conf/httpd.include

    if the file doesn't exist, you can create one using as a model the one in domain.com/conf

    I hope this helps...
     
  3. path2u

    path2u Guest

    0
     
    subdomain includes not working

    thanks for the reply ...
    I did think of the permissions aspect, and just for kicks tried everything with 777 perms to make sure that was not it.
    Still nothing. They are different users so I can see how that could cause troubles.
    I am not sure about the other parameter you mention ... I found this in the main config file ...
    php_admin_value open_basedir (pathtotmp)
    Could this be the one you mentioned or is there another one specifically calling out a restriction ?
    Thanks again,
    Jesse
     
  4. breun

    breun Golden Pleskian

    29
     
    Joined:
    Jun 28, 2005
    Messages:
    1,647
    Likes Received:
    0
    Check your logs, I think it's indeed open_basedir that's restricting access in this case (and rightly so, you don't want all users to be able to read files from other users). Check the Knowledge Base for this one.
     
  5. path2u

    path2u Guest

    0
     
    subdomain issues

    thanks, I just verified that is it by adding include path to config file open_basedir. Is this a security issue now? I guess my question is ... is there a better wya to do what I am trying to do ?
    Is there a way to have multiple sites on the same server all share same header,footer, and menu files without having to edit them in each location everytime I change something ?
    thanks,
    Jesse
     
  6. breun

    breun Golden Pleskian

    29
     
    Joined:
    Jun 28, 2005
    Messages:
    1,647
    Likes Received:
    0
    Re: subdomain issues

    By extending the open_basedir path your just giving a domain access to more directories. If those directories just contain files you want that domain to access then I there is no security problem really.

    Plesk is not really designed to easily share between domains. Usually you want your users to not be able to touch eachother's files. You could extend each domain's open_basedir path automatically upon creation by including a vhost.conf in your skeleton or maybe write a script that distributes your files among domains, share a database from which you pull your info, etc., etc. There are numerous possibilities, but they all require some work on your part. Plesk won't really help you with this.
     
  7. mikk

    mikk Basic Pleskian

    23
    73%
    Joined:
    Jan 29, 2005
    Messages:
    83
    Likes Received:
    0
    Not ideal but depending on how they are crafted you could just include them over http


    include ("http://maindomain/header.php");

    for example.

    This wont be affected by any openbase and/or ownership permission issues this way.
     
  8. breun

    breun Golden Pleskian

    29
     
    Joined:
    Jun 28, 2005
    Messages:
    1,647
    Likes Received:
    0
    Then you're just including the output of header.php. If that's enough, then indeed you're settled. Don't expect access to header.php's variables and functions though (which would be a MAJOR security issue)...
     
Loading...