English 中文(简体)
socket_bind () : 无法绑定地址 [99] (亚马逊EC2上的Ubuntu)
原标题:socket_bind(): unable to bind address [99] (Ubuntu on Amazon EC2)

我试图在EC2频道使用袜子 但当我试图运行代码时,我犯了以下错误:

PHP Warning: socket_bind(): unable to bind address [99]: Cannot assign requested address in sockets_test.php on line 45

以下是相关守则的一部分:

$CFG = new stdClass();
$CFG->chat_serverip =  MY_PUBLIC_EC2_IP ;
$CFG->chat_serverport =  9111 ;

$listen_socket = socket_create(AF_INET, SOCK_STREAM, 0))
socket_bind($listen_socket, $CFG->chat_serverip, $CFG->chat_serverport)

This works just fine if I use 127.0.0.1 or the Private IP. My Security Group has the the rules:

0-65535 0.0.0.0/0 (TCP)
0-65535 0.0.0.0/0 (UDP)
ALL 0.0.0.0/0 (ICMP)
问题回答

您无法与外部 IP 连接, 您必须与内部 IP 连接, 并设置一条规则允许该端口连接到外部 IP 和端口, 当它们连接到外部 IP 和端口时, 它会被转到内部 IP 上 。

" 强势 " 幽灵 < /强者 " 有疑问,

we need bind the internal ip of We can see at ifconfig, not external IP of We can`t see at that.





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签