Page 1 of 1

Can't make socket_bind

PostPosted: 28. June 2011 05:14
by hanpedro
I have a port problem for connecting xdebug. I've installed Kasperskry internet security 2011.

I want to open some port for connecting xdebug. I tried to open 9011 - actually i tried 9000 ~ 9010.

At kaspersky firewall, I opened 9011 at tcp and udp. But the 9011 port is occupied even though it's empty.


Xampp version is 1.7.3 and xdebug is 2.1.1.
And the socket_bind message is;

Code: Select all
Warning: socket_bind() [function.socket-bind]: unable to bind address
Dump $_COOKIE
Variables in local scope (#1)
$address =
 string '127.0.0.1' (length=9)
 
$client =
 Undefined
$port =
 int 9011
 
$sock =
 resource(2, Socket)
 
Unable to bind


Any helpful comment for this problem would be appreciated.
Thanks in advance.

Re: Can't make socket_bind

PostPosted: 28. June 2011 06:08
by Sharley
Hello,

How did you check that the port was occupied and empty?

Download and try this little free no install CurrPorts app from here:
http://www.nirsoft.net/utils/cports.html
It will give you much more detail about the ports in use on your PC than the port checker included in 1.7.3 version of XAMPP.

This CurrPorts is the main program in the older XAMPP port checker and for some strange reason it was discontinued and actually there is now no port checker included in the latest versions of XAMPP.

CurrPorts also gives you some control over ports ie. it will allow you to kill selected processes on ports and it has heaps of info about what is occupying ports - a very useful tool for your needs.

Also by clicking a column heading you can sort how you view the details to make it easier to read - for example if you click on the column heading Local Address you will be able to see all the ports using 127.0.0.1 all in one group.

Did you check the Windows firewall also?

Re: Can't make socket_bind

PostPosted: 28. June 2011 08:30
by hanpedro
Sharley/

I've read your posts or replies regading currports, and I checked this port using currports.

Image

About windows firewall, I disabled but Kaspersky's firewall is enabled.

Re: Can't make socket_bind

PostPosted: 28. June 2011 08:44
by Sharley
Seems this is a common xdebug issue:
xdebug unable to bind to port
You may be able to find a solution in the above search results.

Have you tried temporarily disabling Kaspersky to see if it is responsible - you can re-enable it if there is still no change.

Sometimes a reboot after changing settings in Kaspersky helps.

Re: Can't make socket_bind

PostPosted: 28. June 2011 09:26
by hanpedro
Sharley/

After disabling Kaspersky, the socket_bind is showing "waiting....."

The source is here to test port:

Code: Select all
<?php
$address = '127.0.0.1';
$port = 9011;
$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);
?>


I tried restarting apache and rebooting also, but I could not make connection with xdebug's port.

If possible, would you please let me know which combination works with xdebug - windows 7 x64 and firewall + virus vaccine, apache, php, and mysql.

Re: Can't make socket_bind

PostPosted: 28. June 2011 09:45
by Sharley
Not sure after reading some of these forum search results that xdebug even works with XAMPP 1.7.3 version especially if you have perhaps incorrect settings in the php.ini file.

I ran out of time reading them but you may have more time and a deeper interest in getting xdebug working in 1.7.3. - I would be interested in knowing if you are able to find a solution,

Usually when there is a port binding issue it is something using the port or it is blocked by security settings in firewall/antivirus/ZoneAlarm etc.

Good luck with it. :)

Re: Can't make socket_bind

PostPosted: 28. June 2011 09:54
by hanpedro
Sharley/


Thanks for your time.

Re: Can't make socket_bind

PostPosted: 28. June 2011 14:08
by JonB
If you want to know the 'likely issues', read this:

http://bravo.newnetenterprises.com/word ... d-debugger

Good Luck
8)