Jump to content


Photo
- - - - -

Handling OS type globals


  • Please log in to reply
1 reply to this topic

#1 christobal

christobal

    Advanced Member

  • Members
  • PipPipPip
  • 43 posts

Posted 21 September 2004 - 04: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! ;)
To steal ideas from one person is plagiarism; to steal from many is research!

#2 Cameron Allen

Cameron Allen

    Senior Member

  • Administrators
  • 671 posts

Posted 21 September 2004 - 02:33 PM

I will pass this on! =)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users