Re: [PHP] Unix vs PC test for server
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. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Unix vs PC test for server
On Thu, Aug 16, 2001 at 09:57:20PM +0700, 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 if (the OS is Windows) { $siteurl = http:// www.website.com/ ; $mysqlpasswordfilelocation = ... outsideroot.txt ; }else{ $siteurl = http://127.0.0.1/;; $mysqlpasswordfilelocation = ...outsideroot.txt ; } ??? Paul, You could check one of the following variables: $HTTP_SERVER_VARS{OSTYPE} $HTTP_SERVER_VARS{SERVER_NAME} $HTTP_SERVER_VARS{SERVER_ADDR} $HTTP_SERVER_VARS{HTTP_HOST} or $HTTP_SERVER_VARS{DOCUMENT_ROOT} Check phpinfo(), it gives some really usefull info. -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- H: +31 23 5516190 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Unix vs PC test for server
Run a phpinfo() script and look for the $OSTYPE variable...you can use that... jack -Original Message- From: Paul S. [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 16, 2001 10:57 AM To: [EMAIL PROTECTED] Subject: [PHP] Unix vs PC test for server 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 if (the OS is Windows) { $siteurl = http:// www.website.com/ ; $mysqlpasswordfilelocation = ... outsideroot.txt ; }else{ $siteurl = http://127.0.0.1/;; $mysqlpasswordfilelocation = ...outsideroot.txt ; } ??? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Unix vs PC test for server
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 [EMAIL PROTECTED] 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 | | [EMAIL PROTECTED] Computer Consultant | | http://aesric.ucdavis.edu/ http://pgfsun.ucdavis.edu/ | +--- http://pgfsun.ucdavis.edu/open-source-tools.html ---+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Unix vs PC test for server
Run a phpinfo() script and look for the $OSTYPE variable...you can use that... jack -Original Message- From: Paul S. [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 16, 2001 10:57 AM To: [EMAIL PROTECTED] Subject: [PHP] Unix vs PC test for server 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 if (the OS is Windows) { $siteurl = http:// www.website.com/ ; $mysqlpasswordfilelocation = ... outsideroot.txt ; }else{ $siteurl = http://127.0.0.1/;; $mysqlpasswordfilelocation = ...outsideroot.txt ; } ??? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]