Re: Unix vs PC test for server

From: Date: Thu, 16 Aug 2001 15:46:55 +0000
Subject: Re: Unix vs PC test for server
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-63045@lists.php.net to get a copy of this message
Also - see: http://www.php.net/manual/en/function.php-uname.php - it's a PHP4 function. Alternatively, you could check the $SERVER_SOFTWARE (or $HTTP_SERVER_VARS['SERVER_SOFTWARE'], depending on your config) variable; you'd have to parse the OS out of the returned string, though. - steve At 4:59 PM +0200 8/16/01, Alexander Wagner <wagner@globalpark.de> wrote:
Paul S. wrote:
I design a website on a PC, and upload it to UNIX. Of course, there are always one or two variables that I have to keep track of as to whetherteh server is UNIX or PC. There MUST be a simple way to test
Just do a phpinfo(). There should be an environment-variable you should be able to use. The safest way to retrieve them ist getenv(). getenv('SAPI') perhaps?
if (the OS is Windows) { $siteurl = "http:// www.website.com/ "; $mysqlpasswordfilelocation = " ... outsideroot.txt "; }else{ $siteurl = "http://127.0.0.1/"; $mysqlpasswordfilelocation = " ...outsideroot.txt "; }
You could also use a config-file. This way, you could run your scripts on more than two sites. regards Wagner PS: My PC is running UNIX. -- Madness takes its toll. Please have exact change.
-- +------------------------ Open source questions? ------------------------+ | Steve Edberg University of California, Davis | | sbedberg@ucdavis.edu Computer Consultant | | http://aesric.ucdavis.edu/ http://pgfsun.ucdavis.edu/ | +----------- http://pgfsun.ucdavis.edu/open-source-tools.html -----------+

« previous php.general (#63045) next »