|
Posted by Alvaro G. Vicario on 08/22/06 21:45
*** awebguynow escribió/wrote (22 Aug 2006 13:36:43 -0700):
> I'm running PHP on my local WinXP box, but will host on *nix Srv.
>
> So I started to use and OS detect, something like (psuedo-code):
> if ( strpos($_ENV['OS'], "Win") === false ) { *nix } else { Win }
This can't be a good idea... I presume you need to use certain OS-dependent
feature. Why don't you just check for that specific feature?
Anyway, in the "Predefined constants" chapter I see PHP stores the value
for you so you don't depend on environmental variables:
Core Predefined Constants
These constants are defined by the PHP core. This includes PHP, the Zend
engine, and SAPI modules.
PHP_OS (string)
> But the $_ENV global, looks like an empty array Array ( )
> whats the story ?
Check the variables_order directive in "php.ini". There's also a comment
about it in the file:
; - variables_order = "GPCS" [Performance]
; The environment variables are not hashed into the $_ENV. To access
; environment variables, you can use getenv() instead.
--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
--
Navigation:
[Reply to this message]
|