Warning:socket_create (): Unable to create socket [94]: Socket type not supported in/web/xxx/apicookie.php on line 16
Warning:socket_connect () expects parameter 1 to BES resource, boolean given in/web/xxx/apicookie.php on line 28
This is the PHP error I was prompted when I used the function to create the socket!
$socket = Socket_create (AF_INET,0,SOL_TCP);
$result = @socket_connect ($socket, $address, $service _port);
The rest of the variables are not posted!
The code is not wrong! My testing on other servers is normal!
The error is a Linux vps!. I use the domestic AMH panel! The site you created!
The sockets extension is already open!
PHPINFO also saw that it did turn on!
What the hell is the reason? I searched the internet Baidu is no result!
To Google foreign posts that the firewall is blocked! And then I'm going to shut down the firewall! It's still not going to be tested!
I wonder if it's a matter of authority?
Reply to discussion (solution)
Take a good look at the manual, the second parameter is the type. is one of the following:
Sock_stream,sock_dgram,sock_seqpacket,sock_raw,sock_rdm
Yours is 0.
Socket_create (AF_INET,SOCK_STREAM,SOL_TCP)
Socket_create (AF_INET,SOCK_STREAM,SOL_TCP)
Yes, well, it did. Socket_create (AF_INET,SOCK_STREAM,SOL_TCP) passed the
But Socket_connect ($socket, $address, $service _port); It didn't pass.
Warning:socket_connect (): Unable to connect [111]: Connection refused in/web/xxx/apicookie.php on line 28
Solved the problem, thank you.
Socket_create (AF_INET,SOCK_STREAM,SOL_TCP)
Yes, well, it did. Socket_create (AF_INET,SOCK_STREAM,SOL_TCP) passed the
But Socket_connect ($socket, $address, $service _port); It didn't pass.
Warning:socket_connect (): Unable to connect [111]: Connection refused in/web/xxx/apicookie.php on line 28
Socket_create (AF_INET,SOCK_STREAM,SOL_TCP)
Yes, well, it did. Socket_create (AF_INET,SOCK_STREAM,SOL_TCP) passed the
But Socket_connect ($socket, $address, $service _port); It didn't pass.
Warning:socket_connect (): Unable to connect [111]: Connection refused in/web/xxx/apicookie.php on line 28
What's the deal, man?