您好,我有 xinetd 的这项服务:
service MyService
{
port = 8881
socket_type = stream
wait = no
user = nobody
server = /usr/local/bin/php
server_args = /home/file/public_html/php/port/test1.php
log_on_success + = USERID
log_on_failure + = USERID
disable = no
}
我的文件 test1.php:
<? php
$handle = fopen ('php :/ / stdin', 'r');
$input = fgets ($ handle);
fclose ($ handle);
$ip = $_SERVER['REMOTE_ADDR']
echo "Hello {$ input} your IP: $ip";
?>
我无法获取远程IP:
$ip = $ _SERVER['REMOTE_ADDR']
因为我可以得到远程IP??