php includes
- Started
- Last post
- 11 Responses
- vaxorcist0
and if you ever have to do stuff in .aspx on windows, you'll have to unlearn this method... or at least I did once...
- chivas0
Using pathing like that in php include/require is a real pain in the ass.
I think it worked when I used something like
require_once($_SERVER['document... . "/file.php");
or something along those lines. There are several built-in functions that return the base server path.
- meffid0
include $_SERVER['DOCUMENT_root'] . "/includes/include_name.php";
Doesn't work either or I'm getting my . and / in the wrong places.
- airey0
can you make it absolute just for trial purposes (ie: http://www...)
- I'm working on dev server so want to avoid this. If I do it this way it works.meffid
- chivas0
This might help you.
http://www.php.net/manual/en/fun…
"The only solution I have found so far is to create an include file at a known directory level which gets included at the beginning of every page in the site."
- TResudek0
Set a base in a config file that you can go off of. That way when you move servers you need only change that one line to fix all of the paths. Makes life easier.
- meffid0
airey, if I do absolute it can't find a wrapper.
- heavyt0
you can always set the include path.
http://php.net/manual/en/functio…or to go up 2 levels, ../../include.php
- meffid0
or to go up 2 levels, ../../include.php
that works....
- meffid0
2 hours... jesus. Thanks everyone.