473,761 Members | 8,933 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

telling unix and windows apart

Hi everyone,
I wonder is there a way in php for it to find out if the system is a windows
or unix based system. I read $_ENV[WINDIR] is set on windows but not unix
but it does not seem to work.

Thanks for your help.

--
AKA Marketing.com - Internet Marketing (mainly)
http://www.akamarketing.com/hosting
http://www.akamarketing.com/webmaster-forums
t : 353 - 87- 9807628 ||| e: contactATakamar keting.com
Jul 17 '05 #1
10 1565
Dave wrote:
Hi everyone,
I wonder is there a way in php for it to find out if the system is a windows
or unix based system. I read $_ENV[WINDIR] is set on windows but not unix
but it does not seem to work.


You could use $_SERVER['DOCUMENT_ROOT'] to check if the path contians
non-standard slashes '\', if it does, thne you have that stuiff from that
strange company.
//Aho
Jul 17 '05 #2
.oO(Dave)
I wonder is there a way in php for it to find out if the system is a windows
or unix based system. I read $_ENV[WINDIR] is set on windows but not unix
but it does not seem to work.


PHP_OS

Micha
Jul 17 '05 #3
Dave wrote:
I wonder is there a way in php for it to find out if the system is a
windows or unix based system. I read $_ENV[WINDIR] is set on windows
but not unix but it does not seem to work.


Use the PHP_OS constant

--
Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/
Jul 17 '05 #4
support is so quick here, thanks everyone I'm sure I can get one of these
suggestions working, but for the PHP_OS was exactly do I do?

is it like $os = PHP_OS();
echo $os;

Thanks again.

--
AKA Marketing.com - Internet Marketing (mainly)
http://www.akamarketing.com/hosting
http://www.akamarketing.com/webmaster-forums
t : 353 - 87- 9807628 ||| e: contactATakamar keting.com
"Dave" <co*****@akamar keting.com> wrote in message
news:cs******** **@kermit.esat. net...
Hi everyone,
I wonder is there a way in php for it to find out if the system is a windows or unix based system. I read $_ENV[WINDIR] is set on windows but not unix
but it does not seem to work.

Thanks for your help.

--
AKA Marketing.com - Internet Marketing (mainly)
http://www.akamarketing.com/hosting
http://www.akamarketing.com/webmaster-forums
t : 353 - 87- 9807628 ||| e: contactATakamar keting.com

Jul 17 '05 #5
oh guys I actually got it working after doing a quicky on Google. Really
useful. What other constants are avaible? and can anyone give me a URL to a
list or resources for them.

Cheers

--
AKA Marketing.com - Internet Marketing (mainly)
http://www.akamarketing.com/hosting
http://www.akamarketing.com/webmaster-forums
t : 353 - 87- 9807628 ||| e: contactATakamar keting.com
"Dave" <co*****@akamar keting.com> wrote in message
news:cs******** **@kermit.esat. net...
support is so quick here, thanks everyone I'm sure I can get one of these
suggestions working, but for the PHP_OS was exactly do I do?

is it like $os = PHP_OS();
echo $os;

Thanks again.

--
AKA Marketing.com - Internet Marketing (mainly)
http://www.akamarketing.com/hosting
http://www.akamarketing.com/webmaster-forums
t : 353 - 87- 9807628 ||| e: contactATakamar keting.com
"Dave" <co*****@akamar keting.com> wrote in message
news:cs******** **@kermit.esat. net...
Hi everyone,
I wonder is there a way in php for it to find out if the system is a

windows
or unix based system. I read $_ENV[WINDIR] is set on windows but not unix but it does not seem to work.

Thanks for your help.

--
AKA Marketing.com - Internet Marketing (mainly)
http://www.akamarketing.com/hosting
http://www.akamarketing.com/webmaster-forums
t : 353 - 87- 9807628 ||| e: contactATakamar keting.com


Jul 17 '05 #6
.oO(Dave)
oh guys I actually got it working after doing a quicky on Google. Really
useful. What other constants are avaible? and can anyone give me a URL to a
list or resources for them.


It's all in the manual.

Predefined Constants
http://www.php.net/manual/en/reserved.constants.php

Magic constants
http://www.php.net/manual/en/languag...predefined.php

Micha
Jul 17 '05 #7
"Dave" <co*****@akamar keting.com> wrote in
news:cs******** **@kermit.esat. net:
oh guys I actually got it working after doing a quicky on Google.
Really useful. What other constants are avaible? and can anyone give
me a URL to a list or resources for them.

Cheers


just make a file like so, and observe the variables:

<?php

phpInfo();

?>

Jul 17 '05 #8
Good Man wrote:
"Dave" <co*****@akamar keting.com> wrote in
news:cs******** **@kermit.esat. net:
oh guys I actually got it working after doing a quicky on Google.
Really useful. What other constants are avaible? and can anyone give
me a URL to a list or resources for them.

Cheers


just make a file like so, and observe the variables:

<?php

phpInfo();

?>


That gives you a lot of useful information but it doesn't give you the
constants.

Refer to
http://www.php.net/manual/en/languag...predefined.php
http://www.php.net/manual/en/reserve...tants.core.php
http://www.php.net/manual/en/reserve...s.standard.php

The unfortunate thing about these lists is they do not explain what the
constants are actually for. Most in reserved.consta nts.core.php are
self explanatory whereas reserved.consta nts.standard.ph p aren't so, but
are generally referenced in the relevant functions.

--
Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/
Jul 17 '05 #9
Dave wrote :
Hi everyone,
I wonder is there a way in php for it to find out if the system is a windows
or unix based system. I read $_ENV[WINDIR] is set on windows but not unix
but it does not seem to work.


<?
phpinfo();
?>

First line.

Martin

--
Epur Si Muove (Gallileo Gallilei)
Jul 17 '05 #10

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

Similar topics

3
6555
by: dpackwood | last post by:
Hello, I have two different scripts that do pretty much the same thing. The main perl script is on Windows. It runs and in the middle of it, it then calls out another perl script that then should run on a Unix box I have. Both scripts run ok, except for the part when Windows try's to call out the Unix script. I have it set up where the Unix is mapped through a drive letter and can drop stuff into the Unix box. It is going through another...
3
3606
by: Rob | last post by:
Does anyone know if there are any good comparisons between Windows and Unix performance? Or does anyone have examples of Oracle databases running large numbers (200+) of concurrent users. I am trying to investigate what size implementations can be placed onto Windows 2000 / Windows 2003 as opposed to UNIX but cannot find much data. Any information would be much appreciated. Cheers.
6
4132
by: Matthew | last post by:
How would I go about creating a simple "hello world" program that will run in Unix. I am using MS Visual C++.
2
1805
by: Louise GK | last post by:
Hi there. I've written a simple program that makes a simple GET form with a text input box and displays $_GET when submitted. Using Windows Character Map, I pasted in the Cyrillic capital "Ya" (the backward R) and it came out as "Я". So far so good. Then I sent in " Я" (The is the Cyrillic character again.) That came out as "Я Я". How can I please tell the difference between the Cyrillic and the character sequence '&', '#',
22
3077
by: Ryan M | last post by:
I've been programming for a while, but most of my experience is on unix. How do C compilers work on operating systems that weren't written in C? And that have no libc? Compiling C on unix seems so easy. Everything in the code either goes right to machine code, or links to a C library (often libc) or links to the kernel. Are there libc equivalents on non-unix OSes? -- Using M2, Opera's revolutionary e-mail client:...
48
2596
by: Daniel Rudy | last post by:
Hello, On a x86 machine, what is the format of a pointer in C? I know for a fact that the x86 p-mode uses a /selector:offset/ notation where the selector is defined in either the GDT or LDT. Does that carry over into the pointer, or does Unix use the flat memory model? -- Daniel Rudy
18
5651
by: Sharon | last post by:
is microsoft going to develop .Net for Unix? or at lest CLR for Unix? 10x
15
5891
by: Alpha | last post by:
I was told that Unix API can only be called using C++, ATL and MFC. However, I was also told that C# can do that through Pinvoke to a DLL that interfaces with the Unix API. Can someone direct me to some good article to read up on this? Basically, I'm looking a possible project that has a Window client but needs to get information from Unix side sometime by calling some API in Unix. Many thanks in advance, Alpha
1
3835
RRick
by: RRick | last post by:
I have a unix C++ project that needs to be converted over to windows visual studio. I'm not sure of the exact version of VS, but it's a recent version, probabIy 2003 or 2005. I would like the windows directory tree to mimic the unix tree as closely as possible, but I don't want duplicate files and other inconsistencies. I have come up with an idea but I don't know how close it fits a "typical" windows project. If you know of specific...
0
9554
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10136
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9923
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9811
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7358
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6640
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3911
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3509
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.