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 4 1367
On Jul 3, 10:23 am, "Schroeder, AJ" <a...@qg.comwro te:
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_SEPAR ATOR to see if it's / or \ -- I have yet to find a *nix
system that uses \ and a Windows system that uses /.
On 03.07.2007 16:23 Schroeder, AJ 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
hi there
look for php_uname()
--
gosha bine
extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
Schroeder, AJ schrieb:
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?
Why? What's the problema with the constant PHP_OS ?
OLLi
--
Die Tür zur Vergangenheit kann man nicht öffnen, ohne dass sie knarrt.
[Der Adler 103]
Oliver Grätz wrote:
Schroeder, AJ schrieb:
>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?
Why? What's the problema with the constant PHP_OS ?
OLLi
No problem... I guess I didn't know about it since I always ran the scripts
from Redhat.
I am using a the constants PHP_OS and DIRECTORY_SEPAR ATOR to check and see
what os the script is running from.
I also didn't know about php_uname(), so I am using that for something in my
scripts, too.
Thank you to all who responded, the suggestions really helped!
AJ Schroeder This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Tim Gosselin |
last post by:
I am writing a tcp tunnel but cannot find a way of detecting when a socket
shuts down its read end without writing to the socket. For testing the
write end of the remote endpoint I just do a:
if not sock.recv(buffsize)
I cannot write to the socket and check if send returns 0 though, because
that involves sending data out of the which may not have come in yet.
When I try polling the socket with:
|
by: Frances Del Rio |
last post by:
pls, why is this not working?
<SCRIPT language=JavaScript type="text/javascript">
var br = '<SCRIPT language=Javascript'
br += 'src="js_pop.js" type="text/javascript">'
br += '</SCRIPT>'
var op = '<SCRIPT language=Javascript'
op += 'src="js_pop-op.js" type="text/javascript">'
op += '</SCRIPT>'
if (navigator.userAgent.indexOf('Opera') != -1 ) {
|
by: fox |
last post by:
Maybe this is not the best group to ask this question,
but I don't know a better one.
I'm looking for a *portable* program in C (I mean source code)
to detect whether unaligned word access is:
a. handled by the main processor (e.g. x86)
b. not supported (e.g. Sparc running Solaris)
c. emulated in software (e.g. Alpha running Linux)
By "unaligned word access" I mean access to a 16-bit word
|
by: Mark Rae |
last post by:
Hi,
I'm looking for a reliable way of detecting the version of Windows that the
..NET framework is installed on, specifically the service pack. Currently,
I'm using System.Environment.OSVersion and pulling the Major, Minor, Build
and Revision properties out of that.
However, e.g. Windows XP returns exactly the same values for no initial
build, SP1 or SP2.
|
by: Paul Steele |
last post by:
Some time ago I tracked down the code for detecting the shutdown event
within a C# program. I tested it, it worked, and I moved on. However, I just
discovered that the code is no longer working, and I'm baffled. I've done
some more Google searches and have come up with the same thing. A portion of
the code is below. I call the HookSessionEnding routine in the Load event of
the main form, but the shutdown event code never fires. I'm baffled....
| |
by: regtrashcan |
last post by:
I have a webpage that detects whether Shockwave Player is installed and
the version number. The javascript/vbscript that I use has worked fine
until the latest release of the Shockwave Player. I am still able to
detect the Shockwave Player and the version number when using
Firefox/Netscape, but not with IE. I have my own detection script that
I use, but I've also used the detection scripts supplied from
Macromedia, but it still won't...
|
by: BWill |
last post by:
Hi, I'm writing a file browser, but I'm not sure how I could go about
detecting the drives available on windows and linux systems (preferably
using the standard modules if possible). I guess I could just try to
list root on each letter of the alphabet for windows and see if it
works, but that seems crude; besides, I want to know what kind of drive
each drive/partition is (i.e. is it local and is it a harddrive or
optical drive).
Thanks,
|
by: Cenc |
last post by:
How do I detect the Windows version.
I'm interested in detecting Windows Vista
to see if any visits my site.
|
by: davidson1 |
last post by:
Hello Friends,
I am using HP Laptop.I have a MP3 Player.I used to charge it using my laptop(Windows XP).But Nowadays it is not detecting and charging whenever I connect MP3 Player in my laptop.But when I connect Pendrive and Mouse in my laptop it is detecting.Any Suggestions are welcome.
Thanks in Advance.
|
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...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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,...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |