CodeIgniter Forums
OS CHECK FUNCTION - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: OS CHECK FUNCTION (/thread-3193.html)



OS CHECK FUNCTION - El Forum - 09-15-2007

[eluser]Peter Ivanov[/eluser]
Hello,
is there some CI function that checks if the OS is Windows or Linux


OS CHECK FUNCTION - El Forum - 09-15-2007

[eluser]xwero[/eluser]
You can use the php function get_browser


OS CHECK FUNCTION - El Forum - 09-15-2007

[eluser]Peter Ivanov[/eluser]
no i want to check the SERVER OS not the client


OS CHECK FUNCTION - El Forum - 09-15-2007

[eluser]xwero[/eluser]
Your own server? why would you want to check that?


OS CHECK FUNCTION - El Forum - 09-15-2007

[eluser]Luci3n[/eluser]
$this->agent->platform();

edit: sorry i thought you meant the client


OS CHECK FUNCTION - El Forum - 09-15-2007

[eluser]champs[/eluser]
It really depends on exactly what sort of information you want here, but:

A) If you care about how paths are put together on the system, PHP has the DIRECTORY_SEPARATOR constant. Not that it matters if you use forward slashes for paths in Windows ports of PHP, but you can at least present the information nicely this way.

B) If you want to know what server software you are running under, use php_sapi_name(). It will return "cgi", "isapi" (IIS), "" for command line, etc.

C) If you just care about whether Windows is running, $_ENV['WINDIR'] has no legitimate reason to be set on anything but a Windows box.

HTH.


OS CHECK FUNCTION - El Forum - 09-15-2007

[eluser]esra[/eluser]
[quote author="Peter Ivanov" date="1189872460"]no i want to check the SERVER OS not the client[/quote]

http://www.phpclasses.org/browse/package/3477.html


OS CHECK FUNCTION - El Forum - 09-16-2007

[eluser]Peter Ivanov[/eluser]
Thanks a lot guys