80端口被占用,xp下查看端口被占用情况

    技术2022-06-27  47

    在启动Apache的时候遇到占用80端口,导致服务不能启动,于是CMD查占用80端口的进程..

    直接命令杀死进程:

     

    1.查进程:

    netstat -b -n –a

    -b 为列出进程,必须-b在前,不能是-a在前不然报错.

    -n为端口号

     

    查到是peer.exe 进程PID 632

    2.杀占用80的进程

    CMD下杀进程的命令ntsd.

    ntsd –c q –p 632

    632为我查到的进程 peer.exe(fs2you网络硬盘的程序)的id

    截图:

     

    CMD输出:

    C:/Documents and Settings/Administrator>netstat -n -b -a

    Active Connections

      Proto  Local Address          Foreign Address        State           PID   TCP    0.0.0.0:80             0.0.0.0:0              LISTENING       632   [peer.exe]

      TCP    0.0.0.0:135            0.0.0.0:0              LISTENING       1236 ^C C:/Documents and Settings/Administrator>ntsd -c q -p 632

    C:/Documents and Settings/Administrator>

     

    杀完之后apache启动正常...

     

    附录:

    xp下还有两个好东东tasklist和tskill。tasklist能列出所有的进程,和相应的信息。tskill能查杀进程,语法很简单:tskill 程序名!!

     

    NETSTAT [-a] [-b] [-e] [-n] [-o] [-p proto] [-r] [-s] [-v] [interval]

      -a            显示所有连接和监听端口。   -b            显示包含于创建每个连接或监听端口的                 可执行组件。在某些情况下已知可执行组件                 拥有多个独立组件,并且在这些情况下                 包含于创建连接或监听端口的组件序列                 被显示。这种情况下,可执行组件名                 在底部的 [] 中,顶部是其调用的组件,                 等等,直到 TCP/IP 部分。注意此选项                 可能需要很长时间,如果没有足够权限                 可能失败。   -e            显示以太网统计信息。此选项可以与 -s                 选项组合使用。   -n            以数字形式显示地址和端口号。   -o            显示与每个连接相关的所属进程 ID。   -p proto      显示 proto 指定的协议的连接;proto 可以是                 下列协议之一: TCP、UDP、TCPv6 或 UDPv6。                 如果与 -s 选项一起使用以显示按协议统计信息,proto 可以是下列协议之一:                 IP、IPv6、ICMP、ICMPv6、TCP、TCPv6、UDP 或 UDPv6。   -r            显示路由表。   -s            显示按协议统计信息。默认地,显示 IP、                 IPv6、ICMP、ICMPv6、TCP、TCPv6、UDP 和 UDPv6 的统计信息;                 -p 选项用于指定默认情况的子集。   -v            与 -b 选项一起使用时将显示包含于                 为所有可执行组件创建连接或监听端口的                 组件。   interval      重新显示选定统计信息,每次显示之间                 暂停时间间隔(以秒计)。按 CTRL+C 停止重新                 显示统计信息。如果省略,netstat 显示当前                 配置信息(只显示一次)

    附:NTSD 中所附的帮助文件

    usage: ntsd [-?] [-2] [-d] [-g] [-G] [-myob] [-lines] [-n] [-o] [-s] [-v] [-w]  [-r BreakErrorLevel] [-t PrintErrorLevel]  [-hd] [-pd] [-pe] [-pt #] [-pv] [-x | -x{e|d|n|i} ]  [-- | -p pid | -pn name | command-line | -z CrashDmpFile]  [-zp CrashPageFile] [-premote transport] [-robp]  [-aDllName] [-c "command"] [-i ImagePath] [-y SymbolsPath]  [-clines #] [-srcpath SourcePath] [-QR machine] [-wake ]  [-remote transport:server=name,portid] [-server transport:portid]  [-ses] [-sfce] [-sicv] [-snul] [-noio] [-failinc] [-noshell]

    where: -? displays this help text  command-line is the command to run under the debugger  -- is the same as -G -g -o -p -1 -d -pd  -aDllName sets the default extension DLL  -c executes the following debugger command  -clines number of lines of output history retrieved by a remote client  -failinc causes incomplete symbol and module loads to fail  -d sends all debugger output to kernel debugger via DbgPrint  -d cannot be used with debugger remoting  -d can only be used when the kernel debugger is enabled  -g ignores initial breakpoint in debuggee  -G ignores final breakpoint at process termination  -hd specifies that the debug heap should not be used  for created processes. This only works on Windows Whistler.  -o debugs all processes launched by debuggee  -p pid specifies the decimal process Id to attach to  -pd specifies that the debugger should automatically detach  -pe specifies that any attach should be to an existing debug port  -pn name specifies the name of the process to attach to  -pt # specifies the interrupt timeout  -pv specifies that any attach should be noninvasive  -r specifies the (0-3) error level to break on (SeeSetErrorLevel)  -robp allows breakpoints to be set in read-only memory  -t specifies the (0-3) error level to display (SeeSetErrorLevel)  -w specifies to debug 16 bit applications in a separate VDM  -x sets second-chance break on AV exceptions  -x{e|d|n|i} sets the break status for the specified event  -2 creates a separate console window for debuggee  -i ImagePath specifies the location of the executables that generated  the fault (see _NT_EXECUTABLE_IMAGE_PATH)  -lines requests that line number information be used if present  -myob ignores version mismatches in DBGHELP.DLL  -n enables verbose output from symbol handler  -noio disables all I/O for dedicated remoting servers  -noshell disables the .shell (!!) command  -QR queries for remote servers  -s disables lazy symbol loading  -ses enables strict symbol loading  -sfce fails critical errors encountered during file searching  -sicv ignores the CV record when symbol loading  -snul disables automatic symbol loading for unqualified names  -srcpath specifies the source search path  -v enables verbose output from debugger  -wake wakes up a sleeping debugger and exits  -y specifies the symbol search path (see _NT_SYMBOL_PATH)  -z specifies the name of a crash dump file to debug  -zp specifies the name of a page.dmp file  to use with a crash dump  -remote lets you connect to a debugger session started with -server  must be the first argument if present  transport: tcp | npipe | ssl | spipe | 1394 | com  name: machine name on which the debug server was created  portid: id of the port the debugger server was created on  for tcp use: port=  for npipe use: pipe=  for 1394 use: channel=  for com use: port=,baud=,  channel=  for ssl and spipe see the documentation  example: ... -remote npipe:server=yourmachine,pipe=foobar  -server creates a debugger session other people can connect to  must be the first argument if present  transport: tcp | npipe | ssl | spipe | 1394 | com  portid: id of the port remote users can connect to  for tcp use: port=  for npipe use: pipe=  for 1394 use: channel=  for com use: port=,baud=,  channel=  for ssl and spipe see the documentation  example: ... -server npipe:pipe=foobar  -premote transport specifies the process server to connect to  transport arguments are given as with remoting

    Environment Variables:

    _NT_SYMBOL_PATH=[Drive:][Path]  Specify symbol image path.

    _NT_ALT_SYMBOL_PATH=[Drive:][Path]  Specify an alternate symbol image path.

    _NT_DEBUGGER_EXTENSION_PATH=[Drive:][Path]  Specify a path which should be searched first for extensions dlls

    _NT_EXECUTABLE_IMAGE_PATH=[Drive:][Path]  Specify executable image path.

    _NT_SOURCE_PATH=[Drive:][Path]  Specify source file path.

    _NT_DEBUG_LOG_FILE_OPEN=filename  If specified, all output will be written to this file from offset 0.

    _NT_DEBUG_LOG_FILE_APPEND=filename  If specified, all output will be APPENDed to this file.

    _NT_DEBUG_HISTORY_SIZE=size  Specifies the size of a server's output history in kilobytes

    Control Keys:

    Quit debugger  Break into Target  Force a break into debuggee (same as Ctrl-C)  Debug Current debugger  Toggle Verbose mode  Print version information  ntsd: exiting - press enter ---

     

    本文来自博客,转载请标明出处:http://blog.csdn.net/gumanren/archive/2009/10/15/4673105.aspx


    最新回复(0)