Richard Korts
asked on
Path info
We have a live system & a test system on the same host. The test system is at www.xyz.com/test. The live system is at www.xyz.com.
Apache server.
How can I determine, from within an executing php program, which one I'm in?
Thanks
Apache server.
How can I determine, from within an executing php program, which one I'm in?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, I kind of remember that from previously.
I found another way. I know the base file in both systems is index.php. So I did this:
$path = realpath("index.php");
$lp = strlen($path);
$type = "prod";
for ($j = $lp - 1; $j >0; $j--) {
if (substr($path,$j,1) == "/") {
if (substr($path, $j-4,4) == "test") {
$type = "test";
break;
}
}
}
echo $type;