473,474 Members | 1,857 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Re: Check if a certain service is running on the server

On Oct 23, 9:43*am, Curtis <dye...@gmail.comwrote:
Gordon wrote:
On Oct 22, 5:34 pm, Shadlan <shad...@arjoc.comwrote:
Hi.
I need to know if a service is running on my server. Is there any PHP
instruction that I can use to do this?
If the service accepts incoming connections then you might be able to
use curl to try and connect to the machine on the port associated with
the service in question. *If the service doesn't accept connections
then some other approach would be needed. *I've not looked closely at
the responses already made but at first glance they look like they
could work.

Seems like fsockopen() would probably be sufficient.

--
Curtis
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
Oct 23 '08 #1
0 2894

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows...
2
by: epaetz | last post by:
I'm getting Not associated with a trusted SQL Server connection errors on a .Net windows service I wrote, when it's running on my application server. It's not a problem with mixed mode...
1
by: Jonah Olsson | last post by:
Hi guys, I need to listen for incoming requests from a Java web service application (or actually JAXB) on a certain port on the server. The .NET application receiving the request is running on...
2
by: Chris Podmore | last post by:
I don't know if this is the correct newsgroup but I couldn't find one for Windows Services Is it possible to check that a Windows Service is still running from another machine The idea being a...
4
by: Lucas Tam | last post by:
Hi all, If I create a serviceController like: srvController = New ServiceController("Fubar") serviceController will be created regardless if the service exists or not. It will only throw an...
7
by: Joris De Groote | last post by:
Hi, can vb check if a windows service is running or not? ( Webclient ) Thanks Joris
3
by: Michael Maes | last post by:
Hi, We have a windows service passing objects to a client application by remoting. The windows service is started and running successfully. * When the client app is running on the same...
12
by: tshad | last post by:
What would be a good way to check programmatically whether a service was running? We have a service that dies periodically and I need to check to see if this service is running. I know how to...
12
by: Shadlan | last post by:
Hi. I need to know if a service is running on my server. Is there any PHP instruction that I can use to do this?
0
marktang
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,...
0
jinu1996
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...
1
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.