Unable to find the socket transport "http"/"https"

2016-06-06 13:15:34 +08:00
 freejishu

今天给 dz 修锅,结果发现 UCenter 通讯不正常。我做了如下测试:

1 、按照网上的初级教程重置通讯 KEY 等,无效。

2 、修改后台 ip+VPS hosts 都指向 127.0.0.1 (但是事实证明就是 127.0.0.1 )

3 、把网站的 80 口打开,因为以前都是 https 强制( 301 在前端 CDN 上)

4 、试着查查看是不是环境(fsockopen)问题,然后:

<?php

$fp = fsockopen("http://xxxxxxxx",
 80, $errno, $errstr, 30);   
if (!$fp) {   
echo "$errstr ($errno)<br />\n";   
} else {   
$out = "GET / HTTP/1.1\r\n";   
$out .= "Host: xxxxxxxxx\r\n";   
$out .= "Connection: Close\r\n\r\n";   
 
fwrite($fp, $out);   
while (!feof($fp)) {   
echo fgets($fp, 128);   
}   
fclose($fp);   
}  ;

?>

(allow_url_fopen:On) 结果 PHP 给我返回了这么一句: Unable to find the socket transport "http" - did you forget to enable it when you configured PHP? (42852192)。更换成 https 后引号内又变成了 https 。 麻麻,为何别人家的机器不这样 QAQ

搜索了半天,发现出现这个问题的大多是 windows , linux 很少见,因而没有找到合适的解决方案(那些提问者也都不了了之)。

机器内的 curl 正常,不论有没有 s ,也就意味着 openssl 应该没啥问题。——求助广大 V 友们,问题到底出现在哪里?如果需要重新编译 php ,又需要加上哪个参数?(原来是 lnmp 包)

附: lnmp 编译参数:

'./configure' '--prefix=/usr/local/php' '--with-config-file-path=/usr/local/php/etc' '--enable-fpm' '--with-fpm-user=www' '--with-fpm-group=www' '--with-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd' '--with-iconv-dir' '--with-freetype-dir=/usr/local/freetype' '--with-jpeg-dir' '--with-png-dir' '--with-zlib' '--with-libxml-dir=/usr' '--enable-xml' '--disable-rpath' '--enable-bcmath' '--enable-shmop' '--enable-sysvsem' '--enable-inline-optimization' '--with-curl' '--enable-mbregex' '--enable-mbstring' '--with-mcrypt' '--enable-ftp' '--with-gd' '--enable-gd-native-ttf' '--with-openssl' '--with-mhash' '--enable-pcntl' '--enable-sockets' '--with-xmlrpc' '--enable-zip' '--enable-soap' '--with-gettext' '--disable-fileinfo' '--enable-opcache' '--enable-intl' '--with-xsl'

附 2 :因为是 DZ ,所以不太可能一个一个改成 curl 。

2332 次点击
所在节点    PHP
2 条回复
oott123
2016-06-06 13:24:44 +08:00
fsockopen 是个 socket 连接函数,接收的第一个参数是 hostname ,本来就不能 open http:// 啥的吧……
你把 http:// 去掉看看……
freejishu
2016-06-06 15:05:48 +08:00
@oott123 =。=去掉之后是 400BadRequest (但是我没设置任何验证)

凭着第六感重新编译了 PHP (原来参数),UC 通讯正常了。。

本题结贴。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/283831

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX