1

我有一个脚本,我一直在我的服务器上运行没有问题,然后今天我突然收到以下错误,在服务器上进行了 dos 攻击。服务器已重新启动并阻止了有问题的 IP 地址,但现在此脚本无法正常工作。我确实认为在试图找出重新安装 apache 模块的服务器出了什么问题的过程中,所以我想知道这是否与那里的某些东西有关。

在第 43 行的 /home/name/public_html/folder/ipology.class.php 中删除了致命错误调用时传递引用

这是第 43 行附近的代码部分:

 function _fetch()
{
    if(!$sock = @fsockopen($this->_whois, $this->_port, &$errno, &$errstr, 10))
        return false;
    else
    {
        fputs($sock, "{$this->_ip}\n");
        while(!feof($sock))
            $buffer .= fgets($sock, 10240);
        fclose($sock);
        $this->_buffer = $buffer;
        return true;
    }
}

我不知道为什么它突然停止工作,或者如果有人有任何想法,我将不胜感激该错误与什么有关。

谢谢

4

2 回答 2

0

我认为您有一个新的 PHP 版本,并且您在示例中使用了引用。

if(!$sock = @fsockopen($this->_whois, $this->_port, &$errno, &$errstr, 10))

删除and&之前的。$errno$errstr

if(!$sock = @fsockopen($this->_whois, $this->_port, $errno, $errstr, 10))

我想你在 PHP 文档中看到的是这个

resource fsockopen ( string $hostname [, int $port = -1 [, int &$errno [, string &$errstr [, float $timeout = ini_get("default_socket_timeout") ]]]] )

这描述了 C 中的实际实现。

于 2013-10-30T22:48:51.313 回答
0

正如您在 PHP 文档中所读到的,您的 PHP 5.4.0 版本在使用“call-time pass-by-reference”时会引发致命错误。

这里说

从 PHP 5.3.0 开始,当您在 foo(&$a); 中使用 & 时,您将收到一条警告说“调用时传递引用”已被弃用。从 PHP 5.4.0 开始,调用时传递引用已被删除,因此使用它会引发致命错误。

http://php.net/manual/en/language.references.pass.php

于 2013-10-30T22:45:51.257 回答