脚本宝典收集整理的这篇文章主要介绍了Php套接字,Apache和CentOS 6.3给出了权限被拒绝,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
但后来我们的生产环境!我通常和Debian一起工作,但是我们的主机决定在我们的专用服务器上安装CentOS,因为NIC在Debian中失败了,而且这只是麻烦了.
我克服了一些问题,并留下了这个问题:如何修复PHP套接字?我读到我需要PHP-common,所以我安装了这个:
# yum install PHP-common
然后我检查了PHPinfo(),我得到了这个
'./configure' '--wITh-openssl' '--enable-sockets' ...
所以如果你问我这个看起来很好,openssl和socket都已安装并且应该正常工作,但事实并非如此.我在Stack Overflow上找到了这个脚本:
<?PHP //just in case if (!extension_loaded('sockets')) { die('The sockets extension is not loaded.'); } echo '<p><strong>Establishing connection...</strong></p>'; $socket = socket_create(AF_inet,SOCK_STREAM,0); if (!socket_connect($socket,"stackoverflow.COM",80)) { die('Socket error : '.socket_strerror(socket_last_error())); } echo '<p><strong>Connection successful!</strong></p>'; $request = join("\n",array( "GET / HTTP/1.1","Connection: close","Host: stackoverflow.com","User-Agent: Mozilla/5.0 (Windows NT 6.1)","Accept: text/htML,*/*;q=0.8","")); socket_write($socket,$request,strlen($request)); $response = socket_read($socket,2048); echo "<p><strong>This is the received data : </strong></p>"; echo '<PRe>'.htmlentities($response).'</pre>'; socket_close($socket);
这个输出让我完全惊讶:
Establishing connection... Connection successful! This is the received data : HTTP/1.0 408 Request Time-out Cache-Control: no-cache Connection: close Content-type: text/html <html><body><h1>408 Request Time-out</h1> Your browser didn't send a complete request in time. </body></html>
但是,我的剧本还没有运作?
以上是脚本宝典为你收集整理的Php套接字,Apache和CentOS 6.3给出了权限被拒绝全部内容,希望文章能够帮你解决Php套接字,Apache和CentOS 6.3给出了权限被拒绝所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。