适用于Windows Server 2003的PHP SSL

我有Apache 2.2.4和PHP 5.2.6的Windows Server 2003 R2。 我想通过https(SSL)访问页面。

而我得到这个错误(Zend框架GData):

Unable to find the socket transport "ssl" - enter code here did you forget to enable it when you configured PHP? 

所以我做了什么。 我去了php.ini,我发现了这条线

 extension=php_openssl.dll 

我也安装了Win32 OpenSSL 。

但没有任何工作。 我该怎么办?

好的,有几个步骤可以在这里查看:

  • 首先,创build一个phpinfo()文件来检查PHP的SSL扩展是否已经被启用,我知道你已经启用了它,但是检查你是否在正确的PHP.ini文件中这样做了,并且这个改变实际上正在生效。
  • 确保libeay32.dll和ssleay32.dll位于Windows PATH中的某个位置
  • 确保php_openssl.dll在您的扩展目录中
  • 检查您的phpinfo()文件是否显示正确的扩展名目录。

这些是本教程的相关部分: http : //fash7y.wordpress.com/2011/12/0/solved-how-to-set-up-https-with-openssl-in-wamp/

继续使用http://openssl-for-windows.googlecode.com/files/openssl-0.9.8k_WIN32.zip

好的,我们来做下一步。 ;)

  1. 创buildSSL证书和密钥

一个。 Ekstrak OpenSSL到你的目录,并复制这个文件:

 openssl.cnf to .\Apache2.2.11\conf\ from folder bin, copy all files to .\Apache2.2.11\bin\ 

//replace旧的文件! :d

湾 在search菜单中inputCMD打开DOS命令窗口。

C。 input这个cd C:\ wamp \ bin \ apache \ apache2.2.11 \ bin

d。 input以下命令,创build1024位encryption的服务器私钥:openssl genrsa -des3 -out server.key 1024

/ /它会问你一个密码短语(密码),只需input你喜欢的任何密码。

即 从RSA私钥中删除密码(同时保留原始文件的备份副本)。 input这个:

复制server.key server.key.org

openssl rsa -in server.key.org -out server.key

/ /它会问你的密码,只需键入它。

F。 使用刚刚创build的RSA密钥创build一个自签名证书(X509结构)。 input:openssl req -new -x509 -nodes -sha1 -days 365 -key server.key -out server.crt -config C:\ wamp \ bin \ apache \ apache2.2.11 \ conf \ openssl.cnf

  1. 复制server.key和server.crt文件

一个。 在Apache2.2.11 \ conf \中,创build两个名为ssl.key和ssl.crt的文件夹

湾 将server.key文件复制到ssl.key文件夹,并将server.crt文件复制到ssl.crt文件夹

  1. 编辑httpd.conf文件,php.ini和httpd_ssl.conf

一个。 打开httpd.conf文件

湾 在下面的行中删除注释“#”:LoadModule ssl_module modules / mod_ssl.so

C。 删除包含conf / extra / httpd-ssl.conf的行中的注释“#”

d。 打开这个文件 – > C:\ wamp \ bin \ php \ php5.3.8 \ php.ini

即 删除评论“;” 在说:extension = php_openssl.dll的行

F。 打开这个文件 – > C:\ wamp \ bin \ apache \ Apache2.2.11 \ conf \ extra \ httpd_ssl.conf

G。 find这样一行:。

H。 在它之后,改变说:

 Change the line “DocumentRoot …” to DocumentRoot “C:/wamp/www/” Change the line “ServerName…” to ServerName localhost:443 Change the line “ErrorLog….” to Errorlog “C:/wamp/bin/apache/Apache2.2.11/logs/sslerror.log” Change the line “TransferLog ….” to TransferLog “C:/wamp/bin/apache/Apache2.2.11/logs/sslaccess.log” Change the line “SSLCertificateFile ….” to SSLCertificateFile “C:/wamp/bin/apache/Apache2.2.11/conf/ssl.crt/server.crt” Change the line “SSLCertificateKeyFile ….” to SSLCertificateKeyFile “C:/wamp/bin/apache/Apache2.2.11/conf/ssl.key/server.key” Change the line which says <Directory “C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin”> or something like that (sorry I'm forget what its default dir :p) to <Directory “C:/wamp/www/”> Add the following lines inside those <Directory … >…</Directory> tags: Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all Change the line “CustomLog…” to CustomLog “C:/wamp/bin/apache/Apache2.2.11/logs/ssl_request.log” 
  1. 确保它的工作!

一个。 在以前的DOS命令窗口中,inputhttpd -t。 如果显示Sysntax正常,则转到下一步。 如果不是,则更正错误的语法并重新执行步骤3。

湾 重新启动Apache服务器。 如果重新启动成功,则打开浏览器并inputhttp.s localhost /

怎么样? 工程,呃? Congratz! :d

  1. 试试这个:htt..localhost