473,787 Members | 2,971 Online
Bytes | Software Development & Data Engineering Community
+ 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.c omwrote:
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.fsocko pen]: 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.p hp 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 2910

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

Similar topics

11
3765
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 2003 Server or ADO or ODBC issue, I am posting this on all of the three newsgroups. That's the setup: Windows 2003 Server with IIS and ASP.NET actiavted Access 2002 mdb file (and yes, proper rights are set on TMP paths and path,
2
2581
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 security. I'm set for mixed mode and I've been running the service on the app server for over a month with no problem. My database is running on a second server and both are under the same domain. The problem has occurred twice over the last two months.
1
2236
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 the same server. The Java application is used to communicate with another server outside the firewall, and is part of a component from a partner company. We need to connect this component to our system built in .NET. The XML messages are sent to...
2
5932
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 couple of machines will be running my Windows Services to handle certain parts of our application, these machines will be located in the server room. I would like to create an application that runs on one of the users PC's that checks that these...
4
15026
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 exception if I access the properties of the serviceController.
7
25665
by: Joris De Groote | last post by:
Hi, can vb check if a windows service is running or not? ( Webclient ) Thanks Joris
3
2320
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 machine as the windows service (W2K3) every method gets executed successfully. * When the client app is running on a different machine (XP SP2), some methods from the remote object the client calls make client hang. Other
12
14539
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 check to see if the status is in stopped or running mode. But that doesn't tell me if it is actually running. I need to know this so that if it happens I can programmatically start the same service on another machine.
12
12847
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
9655
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, 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...
0
10363
Oralloy
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...
0
10169
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 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...
1
10110
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,...
0
9964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6749
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5398
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...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.