I'm trying to set up a document root definition for my program to make it more portable. As it stands, I'm doing things like this:
# /myApp/index.php
# ini_set("doc_root", "http://localhost/myApp/"); // Doesn't work, import fails
$_SERVER['DOCUMENT_ROOT'] = "includes/myinclude.php"; // gets rid of the error
require_once($_SERVER['DOCUMENT_ROOT'] . "includes/myinclude.php");
I don't get any errors on the include when I forcibly set the value with the = sign, but the file doesn't seem to be imported correctly. When I try to access the class inside, it says the class doesn't exist.
However, if I copy myinclude.php directly into the same folder as index.php, then use require_once("myinclude.php") everything works perfectly.
Any thoughts?