PDA

View Full Version : Handling OS type globals


christobal
09-21-2004, 01:47 AM
The SMT addresses the foliowing machine configurations:

Windows OS ( Assumming IIS ) or
Linux (apache)
When running setup on a Windows machine with Apache the setup registers globals as Linux Machine.
From Code:
################################################## ######
// Register as global for use elsewhere
if (!session_is_registered("WIN_FULL_PATH")) { session_register("WIN_FULL_PATH"); }
$WIN_FULL_PATH = ""; // For Linux Servers

$filename = "sohoadmin/config/isp.conf.php";

// Let's Look at what global vars are available to us so that we can determine
// if this is a Windows Server, Windows Server w/Sphera or Linux Server

if (eregi("WIN", $WINDIR)) { // Windows Server


$WIN_FULL_PATH = $PATH_TRANSLATED;
$tmp = eregi_replace("/","\\\\", $PHP_SELF);
$WIN_FULL_PATH = eregi_replace("$tmp", "", $WIN_FULL_PATH);

// Set the configuration file location using full path (Win)
$filename = $WIN_FULL_PATH . "\\sohoadmin\\\\config\\\\isp.conf.php";

/} // End Build Win Full Path
################################################## ###
This structure leaves the Windows/Apache Machine in a state of confusion:

When structure is remarked as below then the path translation behaves correctly

################################################## ###
// Register as global for use elsewhere
//if (!session_is_registered("WIN_FULL_PATH")) { session_register("WIN_FULL_PATH"); }
$WIN_FULL_PATH = ""; // For Linux Servers

$filename = "sohoadmin/config/isp.conf.php";

// Let's Look at what global vars are available to us so that we can determine
// if this is a Windows Server, Windows Server w/Sphera or Linux Server

//if (eregi("WIN", $WINDIR)) { // Windows Server


// $WIN_FULL_PATH = $PATH_TRANSLATED;
// $tmp = eregi_replace("/","\\\\", $PHP_SELF);
// $WIN_FULL_PATH = eregi_replace("$tmp", "", $WIN_FULL_PATH);

// Set the configuration file location using full path (Win)
// $filename = $WIN_FULL_PATH . "\\sohoadmin\\\\config\\\\isp.conf.php";
///
//} // End Build Win Full Path
#################################################
Could we see in future releases a workaround other than remarking code for this now more popular configuration.
TNX! ;)

Cameron Allen
09-21-2004, 11:33 AM
I will pass this on! =)