473,394 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Srv OS compatibility and $_ENV

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 }

but its not working right, and I wondered why.
My OS looks to be set, as shown by WinXPset
ditto for output from phpinfo()
But the $_ENV global, looks like an empty array Array ( )
whats the story ?

Of course I've the incompatible versions of Apache/PHP: A2.2x and
php5.1.x
patched with php5apache2_2.dll
( thats the only reason I didn't cry after installing 5.1.4 and then
having 5.1.5 come out the next day ) It makes you wonder, what part
of 5.1.x am I really using, if any

my settings from phpinfo():
Apache Version Apache/2.2.3 (Win32) PHP/5.2.0RC2-dev

Aug 22 '06 #1
3 2921
*** 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
--
Aug 22 '06 #2
I appreciate your comments and now know the skinny on this subject. I
can use
getenv()
PHP_OS
php_uname()

I'm just very suprised that phpinfo() would report each ENV var, but
these would not go into $_ENV
Also, I did not see PHP_OS mentioned in the manual, but it appears to
be a Standard part of the lang, and I saw quite a few references
online.

Aug 24 '06 #3
*** awebguynow escribió/wrote (24 Aug 2006 13:56:59 -0700):
Also, I did not see PHP_OS mentioned in the manual, but it appears to
be a Standard part of the lang, and I saw quite a few references
online.
It can be found in:

Main : Appendixes : List of Reserved Words : Predefined Constants

I have the extended CHM version and I just typed "pred" in the index input
box ;-)
--
-+ 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
--
Aug 24 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: jerrygarciuh | last post by:
Hello, I wanted to migrate some custom 404 error pages from shtml to php for the ease of email notification of lost pages. However when PHP processes the page $_ENV and $_SERVER both now hold...
0
by: flat_ross | last post by:
If there was one thing nice about "Binary Compatibility" in VB6, it would tell you at compile time that you changed your public interface. I am looking for the same functionality in .NET. I know...
6
by: someone | last post by:
Suppose that I have a class in an assembly that is delivered to the user, what can I do to change the class so that it doesn't break the binary compatibility? That is, user application can run...
13
by: Derek | last post by:
As I understand it there is a good amount of link compatibility among C compilers. For example, I can compile main.c with GCC and func.c with Sun One and link the objects using either linker (GNU...
2
by: Dominic | last post by:
Hi everybody, I'm planning to use serialization to persist an object (and possibly its child objects) in my application. However, I'm concerned about the backward compatibility issue. I'm...
14
by: frostalicious | last post by:
Used VB.NET (on my client PC) to convert VB6 executable to .NET executable. Placed the .exe file on a network drive on my server. From client, ran .NET Wizards "Trust an Assembly" to make the...
2
by: Carlo | last post by:
I recently started in a new position, and I inherited an application written in VB6 that uses a bunch of DLLs and OCX controls. Version Compatibility is set to Binary at the project level, but since...
1
by: Simon Woods | last post by:
Hi I have a dll ('dll-X') which runs on top of (dependent upon) several other dlls. My build environment has a folder structure binaries compat-libs
17
by: osama178 | last post by:
Hi, What does it mean for an object to be binary compatible? And why aren't STL objects binary compatible? Any insights, links, resources for further reading are greatly appreciated. Thanks.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.