openSSL 不适用于 PHP 内置网络服务器 [英] openSSL not working with PHP built-in webserver

查看:27
本文介绍了openSSL 不适用于 PHP 内置网络服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

操作系统: Ubuntu 12.04 64 位

OS: Ubuntu 12.04 64-bit

PHP 版本: 5.4.6-2~precise+1

PHP version: 5.4.6-2~precise+1

当我通过内置网络服务器 (php5 -S localhost:8000) 测试 https 页面时,Firefox (16.0.1) 说加载问题:连接中断",而终端告诉我"::1:37026 请求无效(不支持的 SSL 请求)".

When I test an https page I am writing through the built-in webserver (php5 -S localhost:8000), Firefox (16.0.1) says "Problem loading: The connection was interrupted", while the terminal tells me "::1:37026 Invalid request (Unsupported SSL request)".

phpinfo() 告诉我:

  • 注册流套接字传输:tcp、udp、unix、udg、ssl、sslv3、tls
  • [curl] SSL:是的
  • SSL 版本:OpenSSL/1.0.1
  • openssl:

  • Registered Stream Socket Transports: tcp, udp, unix, udg, ssl, sslv3, tls
  • [curl] SSL: Yes
  • SSL Version: OpenSSL/1.0.1
  • openssl:

OpenSSL 支持:已启用

OpenSSL support: enabled

OpenSSL 库版本 OpenSSL 1.0.1 2012 年 3 月 14 日

OpenSSL Library Version OpenSSL 1.0.1 14 Mar 2012

OpenSSL 标头版本 OpenSSL 1.0.1 2012 年 3 月 14 日

OpenSSL Header Version OpenSSL 1.0.1 14 Mar 2012

是的,http 页面工作正常.

Yes, http pages work just fine.

有什么想法吗?

推荐答案

请参阅有关内置网络服务器 shim 的手册部分:
http://php.net/manual/en/features.commandline.webserver.php

See the manual section on the built-in webserver shim:
http://php.net/manual/en/features.commandline.webserver.php

它不支持 SSL 加密.它用于普通的 HTTP 请求.openssl 扩展和功能支持无关.它不接受请求或通过流包装器发送响应.

It doesn't support SSL encryption. It's for plain HTTP requests. The openssl extension and function support is unrelated. It does not accept requests or send responses over the stream wrappers.

如果您希望 SSL 在其上运行,请尝试使用 stunnel 包装器:

If you want SSL to run over it, try a stunnel wrapper:

php -S localhost:8000 &   
stunnel3 -d 443 -r 8080  

反正只是用来玩玩的.

这篇关于openSSL 不适用于 PHP 内置网络服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆