Page 1 of 1

include/open_basedir restriction problem

Posted: Wed Jun 28, 2006 11:53 am
by DeSuper
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

Posted: Wed Jun 28, 2006 12:08 pm
by RobertGonzalez
As a last resort you can use subdirs with rewrite to mock the look of a subdomain. Other than that, it sounds like the server security settings are going to be keeping from doing what you want.

Posted: Wed Jun 28, 2006 12:21 pm
by DeSuper
Hi Everah,

Thanks for the fast reply! I've given up hope and I'm changing it, using subdirs, makes life a lot easier anyway.

The rewrite is a very good :idea:.. Thanks a lot!

@ everybody else..

I'm still curious for some other ideas..

Posted: Wed Jun 28, 2006 12:32 pm
by RobertGonzalez
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?

Posted: Wed Jun 28, 2006 12:40 pm
by DeSuper
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..

Posted: Wed Jun 28, 2006 1:23 pm
by RobertGonzalez
No. This is how one of my sites does it:

Code: Select all

/public_html/ #Main Domain
/public_html/subdomain/ #This gets mapped to subdomain.maindomain.com
Another one does it like this:

Code: Select all

/public_html/ #Main Domain
/subdomain1/
/subdomain2/
/subdomain3/
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.