简体   繁体   English

xdebug无法使用WAMP绑定到端口9000

[英]xdebug can't bind to port 9000 with WAMP

I'm running: WAMP Server Version 2.5 PHP Version 5.5.12 Aparche 2.4.9 Mysql 5.6.17 Windows 7 Xdebug 2.2.5 我正在运行:WAMP Server版本2.5 PHP版本5.5.12 Aparche 2.4.9 Mysql 5.6.17 Windows 7 Xdebug 2.2.5

I've installed the recommended version of xdebug using the xdebug wizard that they offer on their website and configured my php.ini file like so: 我已经使用他们在其网站上提供的xdebug向导安装了推荐的xdebug版本,并按如下方式配置了我的php.ini文件:

xdebug.remote_autostart=on
xdebug.remote_enable=1
xdebug.remote_handler="dbgp"
xdebug.remote_host= "localhost"
xdebug.remote_port=9000
xdebug.remote_mode=req
xdebug.idekey="netbeans-xdebug"
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "my path"
xdebug.show_local_vars=0

Then I attempted to test xdebug using the method outlined here: https://blogs.oracle.com/netbeansphp/entry/howto_check_xdebug_installation 然后,我尝试使用此处概述的方法测试xdebug: https ://blogs.oracle.com/netbeansphp/entry/howto_check_xdebug_installation

It says create a file with the following code: 它说使用以下代码创建文件:

<?php
$address = '127.0.0.1';
$port = 9000;
$sock = socket_create(AF_INET, SOCK_STREAM, 0);
socket_bind($sock, $address, $port) or die('Unable to bind');
socket_listen($sock);
$client = socket_accept($sock);
echo "connection established: $client";
socket_close($client);
socket_close($sock);
?>

Then access the file through a browser with the attribute ?XDEBUG_SESSION_START=mysession 然后通过具有属性?XDEBUG_SESSION_START = mysession的浏览器访问文件

I've done that and I receive the following error message: 我已经做到了,并且收到以下错误消息:

Warning: socket_bind(): unable to bind address [10048]: Only one usage of each socket address     (protocol/network address/port) is normally permitted. in stuff.php on line 5
Call Stack
#   Time    Memory  Function    Location
1   0.0010  242312  {main}( )   ..\stuff.php:0
2   0.0010  242976  socket_bind ( ) ..\stuff.php:5
Unable to bind

So I went to command prompt ran netstat -aon and found that a process with the pid of 3300 is listening on 0.0.0.0:9000. 所以我去了命令提示符下运行netstat -aon,发现进程号为3300的进程正在监听0.0.0.0:9000。 I checked task manager and it turns out that it's httpd.exe. 我检查了任务管理器,结果发现它是httpd.exe。 I've tried to change 我试图改变

xdebug.remote_port=10000

but I get the same message. 但我得到同样的信息。

I'm not sure how to proceed from here. 我不确定如何从这里继续。

The issue seems to have resolved itself after a restart. 重新启动后,问题似乎已自行解决。 I'm not sure what fixed it. 我不确定是什么解决了。

I made a php file with a few commands, only to close the socket. 我用一些命令制作了一个php文件,只是关闭了套接字。 Then I open it in another tab. 然后,在另一个标签中打开它。 So that tab that i was running before (with socket_listen), runs ok now. 这样我之前运行过的选项卡(带有socket_listen)现在可以正常运行了。 Try it. 试试吧。 After some tests, the error stops at all, but appears again later. 经过一些测试,该错误完全停止,但稍后再次出现。 I think it's not a solution, but can help to understand the problem. 我认为这不是解决方案,但可以帮助您理解问题。 This is the code for the second file: 这是第二个文件的代码:

<?php
$address = '127.0.0.1'; 
$port = 9000;
$socks = socket_create(AF_INET, SOCK_STREAM, 0);
socket_close($socks);
?>

我遇到了同样的问题,通过检查php和xampp的版本可以解决该问题:事实证明,xampp是在64位计算机上安装的32位,而我选择了错误的xdebug版本(必须为32位)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM