Reply to Re: Srv OS compatibility and $_ENV

Your name:

Reply:


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
--

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация