Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Super Moderator JohnDubya's Avatar
    Join Date
    Nov 2006
    Location
    Missouri
    Posts
    634
    Thanks
    12
    Thanked 18 Times in 18 Posts

    Need to include() file from subdomain to main domain

    I've been told I need to add an entry to the open_basedir in my httpd.include file to be able to access my main domain from a subdomain. I'm trying to use default PHP pages in my subdomains that are located in the main directory.

    In other words, I want to be able to use an include() in: john.domain.com that will pull files from: domain.com/affiliate_pages

    I tried looking in the httpd.include file, but it's really confusing me. After an hour of researching, I found the vi command to edit files through SSH, but even that is confusing. Where should I put an entry into john.domain.com that will allow access to the main domain's files?

  • #2
    Super Moderator JohnDubya's Avatar
    Join Date
    Nov 2006
    Location
    Missouri
    Posts
    634
    Thanks
    12
    Thanked 18 Times in 18 Posts
    Looks like I figured it out after two hours of Googling for help on using SSH, using Unix commands, and editing the httpd.include file. Sheesh. For anyone who comes on this topic later, I was able to add the directory I wanted the subdomain to use by adding an entry after the :/tmp entry. In other words, the open_basedir setting used to say:

    /home/httpd/vhosts/domain.com/subdomains/john/httpdocs:/tmp

    But I changed it to say

    /home/httpd/vhosts/domain.com/subdomains/john/httpdocs:/tmp:/home/httpd/vhosts/domain.com/httpdocs

    That allows the subdomain john.domain.com to use files from the main domain.com directory.

    A couple tips:

    • You need to separate each directory you want the subdomain to use with a colon in Unix...a semi-colon in Windows.
    • If you want to be able to use every subdirectory under the directory you specify, don't put a trailing slash. But if you want only the directory you specify to be accessible, use a trailing slash.
    • You have to restart the Apache (also called httpd) service through your server before the changes you save will take effect.
    • Here's the brief tutorial for the Unix VI editor that I used to edit the httpd.include file. http://www.eng.hawaii.edu/Tutor/vi.html#search


    Hope this helps someone and saves some headaches I wish I didn't have to go through!
    Last edited by JohnDubya; 06-08-2007 at 06:02 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •