php script to check if a windows service is running?
#2
Scooby Regular
Join Date: Mar 1999
Location: The Great White North
Posts: 25,080
Likes: 0
Received 0 Likes
on
0 Posts
fsockopen() ?
I can't claim I know what on earth the above does though I just did a quick google. I'm still learning php
Code:
if ($handle = fsockopen ('localhost', 80, $errnum, $errmsg, 1)) { echo ('A web server is running on this system<br>'); fclose ($handle); } else { echo ($errnum . ' ' . $errmsg . '<br>'); echo ('A web server is not running on this system<br>'); } if ($handle = fsockopen ('localhost', 443, $errnum, $errmsg, 1)) { echo ('A secure web server is running on this system<br>'); fclose ($handle); } else { echo ($errnum . ' ' . $errmsg . '<br>'); echo ('A secure web server is not running on this system<br>'); } A web server is running on this system Warning: fsockopen() [function.fsockopen]: unable to connect to localhost:443 (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ) in D: \Gordon McVey\apachedev\cmsNew\index.php on line 18 10060 A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. A secure web server is not running on this system
Last edited by Markus; 24 March 2009 at 11:44 AM.
#4
Scooby Regular
Join Date: Sep 1999
Location: Swindon, Wiltshire Xbox Gamertag: Gutgouger
Posts: 6,956
Likes: 0
Received 0 Likes
on
0 Posts
#7
Scooby Regular
Join Date: Sep 1999
Location: Swindon, Wiltshire Xbox Gamertag: Gutgouger
Posts: 6,956
Likes: 0
Received 0 Likes
on
0 Posts
Sorry, not tried using it myself, so I have no sample code. Looking at the manual pages, there is an example for win32_set_service_status so it should be easy enough to work it out
Maybe something like (pseudo code)...
$svcStatus=win32_query_service_status ('ServiceName');
if $svcStatus[1] == WIN32_SERVICE_RUNNING
{
display it's running message
}
Maybe something like (pseudo code)...
$svcStatus=win32_query_service_status ('ServiceName');
if $svcStatus[1] == WIN32_SERVICE_RUNNING
{
display it's running message
}
Trending Topics
Thread
Thread Starter
Forum
Replies
Last Post
Scott@ScoobySpares
Full Cars Breaking For Spares
61
11 January 2021 03:08 PM
Mattybr5@MB Developments
Full Cars Breaking For Spares
33
29 August 2017 07:18 PM
Scott@ScoobySpares
Full Cars Breaking For Spares
7
14 December 2015 08:16 AM
MeisterR
Car Parts For Sale
1
15 September 2015 07:07 PM