无限星辰工作室-客户无限互联网动力之源

标题: fsockopen,pfsockopen函数被禁用时的修改办法 [打印本页]

作者: crx349    时间: 2014-2-18 14:05
标题: fsockopen,pfsockopen函数被禁用时的修改办法
DISCUZ已经能判断当不支持fsockopen,pfsockopen时使用stream_socket_client来建立连接

但UC还没这样的处理。我们主要是修改UC。

修改uc_client/client.php
搜索
  1. if(function_exists('fsockopen')) {
  2. $fp = @fsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);
  3. } elseif (function_exists('pfsockopen')) {
  4. $fp = @pfsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);
  5. } else {
  6. $fp = false;
  7. }
复制代码

修改为
  1. if(function_exists('fsockopen')) {
  2. $fp = @fsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);
  3. } elseif (function_exists('pfsockopen')) {
  4. $fp = @pfsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);
  5. } elseif(function_exists('stream_socket_client')) {
  6. $fp = @stream_socket_client($ip.':'.$port, $errno, $errstr, $timeout);
  7. } else {
  8. $fp = false;
  9. }
复制代码

uc_client/model/misc.php
搜索
  1. if(function_exists('fsockopen')) {
  2. $fp = @fsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);
  3. } elseif (function_exists('pfsockopen')) {
  4. $fp = @pfsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);
  5. } else {
  6. $fp = false;
  7. }
复制代码

修改为
i
  1. f(function_exists('fsockopen')) {
  2. $fp = @fsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);
  3. } elseif (function_exists('pfsockopen')) {
  4. $fp = @pfsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);
  5. } elseif(function_exists('stream_socket_client')) {
  6. $fp = @stream_socket_client($ip.':'.$port, $errno, $errstr, $timeout);
  7. } else {
  8. $fp = false;
  9. }
复制代码

uc_server/model/misc.php
搜索
  1. if(function_exists('fsockopen')) {
  2. $fp = @fsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);
  3. } elseif (function_exists('pfsockopen')) {
  4. $fp = @pfsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);
  5. } else {
  6. $fp = false;
  7. }
复制代码

修改为
  1. if(function_exists('fsockopen')) {
  2. $fp = @fsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);
  3. } elseif (function_exists('pfsockopen')) {
  4. $fp = @pfsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);
  5. } elseif(function_exists('stream_socket_client')) {
  6. $fp = @stream_socket_client($ip.':'.$port, $errno, $errstr, $timeout);
  7. } else {
  8. $fp = false;
  9. }
复制代码

改完这三个文件后,通信成功了,但数据同步还是失败的,还需要在UC应用管理里给应用IP 填上网站的IP。




欢迎光临 无限星辰工作室-客户无限互联网动力之源 (https://www.xmspace.net/) Powered by Discuz! X3.4