The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

detect subdomain document root

Discussion in 'cPanel Developers' started by ScottAN, Feb 7, 2008.

  1. ScottAN

    ScottAN Member

    Joined:
    Apr 2, 2005
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    I am having trouble finding a way to get the document root of a specific subdomain or add-on domain that has been entered in CPanel. I let a user choose a domain or subdirectory to place a certain script by using:

    Code:
    <select name="installdirdomain">
      <cpanel Email="listmaildomainsopt()">
    </select>
    Once the user chooses and submits is there a <cpanel> tag or way to find the document root. I realize this information is in /var/cpanel/userdata/USERNAME/DOMAIN but those files are owned by root and thus I cannot see the information there.

    Any ideas will be greatly appreciated!
     
    #1 ScottAN, Feb 7, 2008
    Last edited: Feb 7, 2008
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    The API2 function SubDomain::listsubdomains will let you get this information. You can even put in a Perl regex for the subdomain name to look for a specific domain.

    You can find the code the X3 theme uses for subdomains in: /usr/local/cpanel/base/frontend/x3/subdomain/live_subdomains_list_content.html

    For addon domains, look at the Park::listaddondomains function call in:
    /usr/local/cpanel/base/frontend/x3/addon/index.html
     
  3. ScottAN

    ScottAN Member

    Joined:
    Apr 2, 2005
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Thanks this is exactly what I was looking for. I appreciate the help. Is there more in depth documentation for these API2 functions for future reference?
     
  4. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Not yet, that documentation is still being completed. At this time, there is no ETA on when that documentation will reach completion.
     
Loading...

Share This Page