Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

stephan-v's avatar

socket_connect permission denied

I am running into the following error message:

socket_connect(): unable to connect [61]: Connection refused

The code that I am using:

$address = 'localhost';
$port = 5600;
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_connect($socket, $address, $port);

I was trying this out on a valet .dev environment with nginx so I guessed it might have to do with not having a proper development environment that supports websockets but after testing I am getting the exact same on my homestead vagrant environment.

Any help with getting more verbose debugging information or a possible solution would be amazing.

All suggestions are welcome.

Cheers.

0 likes
0 replies

Please or to participate in this conversation.