How to find the process that is using the port 80 and apache server.

How to find the process that is using the port 80 and apache server.

When i used the command 'netstat -a|grep 80' it given that port 80 is in listening mode.

I had used the following command:
telnet localhost 80
GET /

I had got some HTML script.

But when I accessed the GUI ( url is http:// ip address of server/hawk.htm )which uses the script '/usr/local/apache/htdocs/hawk.htm' using apache server ( for which default server is 80 and document root is "/usr/local/apache/htdocs") it is different.

Why this is happening.

I am little confused here.

friend there is no command that you can execute that will tell you which process id tied to port 80, stop creating threads everywhere.

To trace what is using a certain port

netstat -an | grep \\.80

will list out the IP address that is using port 80, then of course from there once you have the IP address you should know in your company/organisation which are the webservers that are using which IP address, this knowledge is domain you must know.

The purpose of using telnet localhost 80; GET /

is used for troubleshooting to isolate problems only. If client cannot access url but when determined that telnet GET / is able to return some ascii output means there's nothing wrong with webserver and isolate that it's probably a client connectivity issue.

Of course when you are troubleshooting you must also know what you are doing.

Actually lsof can tell you which process is listening to a port.

When i given the command netstat it resulted as follows (not IP)

netstat -an | grep \\.80

  *.80                 \*.*                0      0 49152      0 LISTEN

when i given 'lsof' it resulted as:

lsof: Command not found

Are you sure you have the correct document root ?
run

ps -ef | grep http

and make sure you are looking at the correct apache instance, there are 2 in Solaris, so it depends on which one you are running

lsof is not part of Solaris and doesn't support it properly anyway.

Use pfiles instead.

i.e.:

pfiles /proc/* > /tmp/pfiles.out

Then look for which process is using port 80 by searching "port: 80" in the pfiles.out file.

He has fixed the problem.
See this thread