息壤的空间禁用了fsockopen pfsockopen这两个函数,安装过程中报错,直接跳到第2步可以安装上。但是应用平台的程序的应用全部不能安装
到第二步提示:该函数需要 php.ini 中 allow_url_fopen 选项开启。请联系空间商,确定开启了此项功能’
这是因为有些主机提供商为了安全禁用了fsockopen函数,但是如果不解决这个问题就没法进行下一步,该怎么办呢!!
经分析,涉及到该函数的文件有:
install/include/install_long.php
'advice_fsockopen' => '该函数需要 php.ini 中 allow_url_fopen 选项开启。请联系空间商,确定开启了此项功能', install/include/install_var.php $func_items = array('mysql_connect', 'fsockopen', 'gethostbyname', 'file_get_contents', 'xml_parser_create'); install/include/install_funtion.php 程序段: function fsocketopen($hostname, $port = 80, &$errno, &$errstr, $timeout = 15) { $fp = ''; if(function_exists('fsockopen')) { $fp = @fsockopen($hostname, $port, $errno, $errstr, $timeout); } elseif(function_exists('pfsockopen')) { $fp = @pfsockopen($hostname, $port, $errno, $errstr, $timeout); } elseif(function_exists('stream_socket_client')) { $fp = @stream_socket_client("tcp://".$hostname.':'.$port, $errno, $errstr, $timeout); } return $fp; }
soruce/function/function_core.php
程序段:
function fsocketopen($hostname, $port = 80, &$errno, &$errstr, $timeout = 15) { $fp = ''; if(function_exists('fsockopen')) { $fp = @fsockopen($hostname, $port, $errno, $errstr, $timeout); } elseif(function_exists('pfsockopen')) { $fp = @pfsockopen($hostname, $port, $errno, $errstr, $timeout); } elseif(function_exists('stream_socket_client')) { $fp = @stream_socket_client($hostname.':'.$port, $errno, $errstr, $timeout); } return $fp; }
修改为
function fsocketopen($hostname, $port = 80, &$errno, &$errstr, $timeout = 15) { $fp = ''; $fp = @stream_socket_client("tcp://".$hostname.':'.$port, $errno, $errstr, $timeout); /* if(function_exists('fsockopen')) { $fp = @fsockopen($hostname, $port, $errno, $errstr, $timeout); } elseif(function_exists('pfsockopen')) { $fp = @pfsockopen($hostname, $port, $errno, $errstr, $timeout); } elseif(function_exists('stream_socket_client')) { $fp = @stream_socket_client($hostname.':'.$port, $errno, $errstr, $timeout); } */ return $fp; }
这样不会影响Discuz的云平台!
最新评论