View Full Version : Need to include() file from subdomain to main domain

06-08-2007, 05:27 PM
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?

06-08-2007, 05:54 PM
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:


But I changed it to say


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! :)