php include_path within a VirtualHost

Problems with the Windows version of XAMPP, questions, comments, and anything related.

php include_path within a VirtualHost

Postby skrwl » 25. May 2004 06:08

After a LOT of messing around tonight, I finally got a VirtualHost working at (for example) http://www.mysite.dev...

One of the reasons I like local development with Apache is using root-based pathnames in the site links... say, a link home is always "/" from anywhere in the structure... it's working great so far with my basic navigation and my links to CSS files, but now my PHP includes aren't working because I don't know how or where to change include_path. Can anyone help out? The thing that's boggling me (besides that it's getting late...) is, how can I change the PHP settings to make includes look to the root of "localhost" for includes on THAT site, and how look to the root of the VirtualHost "www.mysite.dev" for includes on THAT site (and then for another dozen VirtualHosts I'd like to set up)...

Thanks for any help anyone can offer...
skrwl
 
Posts: 3
Joined: 03. April 2004 02:40

Postby Wiedmann » 25. May 2004 10:43

You can set the "include_path"

inside a VirtualHost-container (in httpd.conf) with:
php_value include_path "hereyourincludepath"

or inside a script with:
ini_set('include_path', 'hereyourincludepath');

-----

With the standard include_path (defined in php.ini), the directory where the script is stored is also searched for includes.

Or use absolute paths for includes, or paths relative to the script.
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

php include_path within a VirtualHost

Postby skrwl » 25. May 2004 14:17

Thanks! That works like a charm! What I notice is that PHP will always look for includes in that specific directory; it won't consider, say, "/" as a direction to site root... is there a way to make PHP behave exactly like Apache in this manner, or should I just get used to this the way it is?

Again, thanks for the quick & helpful reply...

-R
skrwl
 
Posts: 3
Joined: 03. April 2004 02:40

Re: php include_path within a VirtualHost

Postby Wiedmann » 25. May 2004 15:18

What I notice is that PHP will always look for includes in that specific directory; it won't consider, say, "/" as a direction to site root...

PHP makes the fileaccess via the filesystem. So, "/" ist not the DocumentRoot, used for an access via the browser ("http://localhost/"), it is the root of the filesystem (like "C:\" in Windows).

is there a way to make PHP behave exactly like Apache in this manner, or should I just get used to this the way it is?

There is a config option "doc_root" in the php.ini. But i think it's better not to use this. Because, you will run in some trouble using your scripts on other webserver.
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 110 guests