Reply to Re: Detecting Windows or *ix?

Your name:

Reply:


Posted by ZeldorBlat on 07/03/07 14:36

On Jul 3, 10:23 am, "Schroeder, AJ" <a...@qg.com> wrote:
> Hello group,
>
> I have a few PHP scripts that poll switches and routers via SNMP. Depending
> on the user, the scripts can be run from either Windows XP or *ix (FreeBSD,
> Redhat, etc)
>
> I am beginning to implement syslog() and openlog() in my scripts and there
> are some suddle differences in how PHP logs to event viewer in Windows and
> syslog in everything else. About the most reliable method I have found in
> detecting Windows is a simple check to see if $_SERVER['OS'] is defined,
> which returns "Windows_NT". On Redhat it doesn't come back as defined at
> all, so that makes the code easy.
>
> I'm sure I am not the first one to attempt this, can anyone else share their
> experiences with this and maybe offer a better way other than checking for a
> predefined constant?
>
> Thanks,
>
> AJ Schroeder

There are lots of ways. You could even look at the constant
DIRECTORY_SEPARATOR to see if it's / or \ -- I have yet to find a *nix
system that uses \ and a Windows system that uses /.

[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

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