[SOLVED] Detect host OS type

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mmanders
Forum Newbie
Posts: 23
Joined: Sun Jan 16, 2005 7:13 pm

[SOLVED] Detect host OS type

Post by mmanders »

I am developing a PHP based system on a Windows platform, but it will be uploaded ultimately to a linux platform - both running the same versions of mysql apache and php. Is there any way I can test, say at the top of a file, what the OS type of the system that the page is currently being served from is?

The reason being, I have an include directory set up on windows machine that I use with set_include_path in each file, this will be different on the linux system because it will use /usr/directory/blah instead of c:\www\blah

I would like to be able to define the $path for set_include_path=$path differently depending on the OS

Hope that makes sense
Thanks in advance?
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

there is a magic constant

Code: Select all

echo PHP_OS;
mmanders
Forum Newbie
Posts: 23
Joined: Sun Jan 16, 2005 7:13 pm

Problem Solved

Post by mmanders »

Thanks! Much appreciated - that is just what I was looking for!
Problem Solved!
Post Reply