[Phpwm] subdomains & includes

Phil Beynon phil at infolinkelectronics.co.uk
Wed Jan 24 09:28:28 GMT 2007


> > So:
> > subdomain.example.com
> > has:
> > include(/admin/config/siteconfig.php);
> > and that works just fine for seeing the database.
> >
> > But
> > www.example.com
> > has:
> > include(http://subdomain.example.com/admin/configs/siteconfig.php);
> > (which can be see to be working from an echo to the page so its not an
> > incorrect path)
> 
> 
> When you include something via http, then the content that gets included  
> will be whatever you get were you to visit the URL in a browser, i.e.  
> apache (or equivalent) is serving the config file as a PHP file, 
> and code  
> is executed. So you'll notice echo'd text, but assignment of 
> variables has  
> no impact on the code that does the include-ing.

So it appears! 

> One option is to rename the file to a '.inc', but then of course anyone  
> can view the contents so probably not sensible for a config file...

That, in the context of the content of the file would be a "bad thing" :-)

> If the files are on the same machine, then you just need to access them  
> via the appropriate filepath.
> 
> Greg
> 
I had it in my head that I'd read somewhere that there was a way of telling either PHP or Apache that if it was from the same instance of Apache or IP address that it would behave differently. 

Phil




More information about the Phpwm mailing list