Hi everybody,
I've the following problem:
I'm building a webshop
I have a domain like domain.com
I want to create multiple shops in subdomains like:
shop1.domain.com / shop2.domain.com / etc..
From these subdomains I want to include the source classes from my main domain so I don't have to copy the whole shop for each instance.
The problems that I've encountered are these:
1. Including http://... doesn't work, the file gets parsed by the server
2. Including from the absolute server path (like /var/www/virtual/.. ) is not allowed, open_basedir restriction in effect.
3. Setting the open_basedir directive in my apache conf file only works for that specific subdomain, I don't want to have to edit the conf everytime I add a subdomain. It's a virtual server, as far as I can see it's not possible to set open_basedir for the entire domain (+subdomains) only one domain at a time.
4. Settind open_basedir in a .htacces file is not allowed
5. Setting it in php.ini has no effect(?) and is undesirable
6. (ini_)Setting the include_path on the page itself still results in a open_basedir restriction error
7. Putting the file in the allowed open_basedir is not conveniant since I'm still working on the classes, uploading will take more time than the changes I make.
So my question:
Does anybody know how to include files from "domain.com/class" into "shop1.domain.nl"?
I've tried and searched, I'm at a loss. Another possibility is to use subdirs in stead of subdomains (http://www.domain.com/shop1), but I think that's ugly..
Thanks in advance..
DeSuper
include/open_basedir restriction problem
Moderator: General Moderators
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
What is the domain, subdomain structure on the server? There was one server I was on that actually created a subdomain as a subfolder then used an apache module to rewrite the subfolder URL to a subdomain. On others I have seen the creation of an entirely new folder with the /public_html/ folder for the subdomain so that it becomes its own account on the server. What is yours like?
something like this:
domain.com
- [cgi-bin]
- [htdocs] -> http://www.domain.com
-- [class]
-- class.php
- [shop1] -> shop.domain.com
-- [htdocs]
- [shop2] -> ...
-- [htdocs]
I don't think this is what you mean by subfolders..
domain.com
- [cgi-bin]
- [htdocs] -> http://www.domain.com
-- [class]
-- class.php
- [shop1] -> shop.domain.com
-- [htdocs]
- [shop2] -> ...
-- [htdocs]
I don't think this is what you mean by subfolders..
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
No. This is how one of my sites does it:
Another one does it like this:
Depending on how these are setup, and how the folders are 'owned', you may be able to use a relative path to the includes to get at what you want.
Code: Select all
/public_html/ #Main Domain
/public_html/subdomain/ #This gets mapped to subdomain.maindomain.comCode: Select all
/public_html/ #Main Domain
/subdomain1/
/subdomain2/
/subdomain3/