我已经按照本指南生成了必要的密钥和证书文件。
How do I allow HTTPS for Apache on localhost?
LoadModule ssl_module modules/mod_ssl.so
<IfModule ssl_module>
<VirtualHost _default_:443>
SSLEngine on
SSLCertificateFile "${CONF_PATH}/certs/localhost.cert"
SSLCertificateKeyFile "${CONF_PATH}/certs/localhost.key"
...
</VirtualHost>
</IfModule>
extension=openssl
[curl]
curl.cainfo="C:\bin\httpd\conf\certs\localhost.cert"
[openssl]
openssl.cafile="C:\bin\httpd\conf\certs\localhost.cert"
通常这是人们会说要复制libeay32
和ssleay32
的地方,但是,为了给其他任何人证明这一点,这些不再是最新版本中包含的文件。现在是libcrypto
和libssh
。我将它们复制到Apache bin目录中。
进入带有phpinfo()
的页面以SSL标记为启用的方式确认这些设置。
让我们执行一些HTTPS请求。
pecl update-channels
Updating channel "doc.php.net"
Channel "doc.php.net" is up to date
Updating channel "pear.php.net"
Channel "pear.php.net" is not responding over http://, failed with message: Connection to `ssl://pear.php.net:443' failed: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?
Trying channel "pear.php.net" over https:// instead
Cannot retrieve channel.xml for channel "pear.php.net" (Connection to `ssl://pear.php.net:443' failed: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?)
Updating channel "pecl.php.net"
Channel "pecl.php.net" is up to date
嗯,那不好。我看到了一些有关从PECL脚本中删除-n
标志的建议。所以我做到了。让我们看看现在是否有所不同。
pecl update-channels
Updating channel "doc.php.net"
Channel "doc.php.net" is up to date
Updating channel "pear.php.net"
Channel "pear.php.net" is not responding over http://, failed with message: Connection to `ssl://pear.php.net:443' failed:
Trying channel "pear.php.net" over https:// instead
Cannot retrieve channel.xml for channel "pear.php.net" (Connection to `ssl://pear.php.net:443' failed: )
Updating channel "pecl.php.net"
Channel "pecl.php.net" is up to date
不,实际上更糟。现在,它为什么会失败的细节就更少了。
对于我为什么没有任何成功的经验,我在这里缺少任何人吗?
答案 0 :(得分:2)
您的HTTPD php.ini(已通过“转到phpinfo()进入页面”进行了检查)可能是与pecl
(命令行)php.ini不同的文件。确保pecl
使用的是启用了openssl的php.ini。另请参见pecl config-show
和https://stackoverflow.com/a/49623714/68939。
答案 1 :(得分:1)
我设法通过编辑pecl.bat使它工作。在此之前:
"%PHP_PEAR_PHP_BIN%" -C -n -d date.timezone=UTC -d output_buffering=1 -d safe_mode=0 -d "include_path='%PHP_PEAR_INSTALL_DIR%'" -d register_argc_argv="On" -d variables_order=EGPCS -f "%PHP_PEAR_INSTALL_DIR%\peclcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9
我将其更改为:
"%PHP_PEAR_PHP_BIN%" -c "%PHP_PEAR_BIN_DIR%\php.ini" -C -n -d date.timezone=UTC -d output_buffering=1 -d safe_mode=0 -d "include_path='%PHP_PEAR_INSTALL_DIR%'" -d register_argc_argv="On" -d variables_order=EGPCS -f "%PHP_PEAR_INSTALL_DIR%\peclcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9
换句话说,我添加了这一部分:
-c "%PHP_PEAR_BIN_DIR%\php.ini"
与here给出的建议相同。
更新
此后,我得到了一个新错误:
Fatal error: Cannot use result of built-in function in write context in C:\xampp\php\pear\Archive\Tar.php on line 639
所以我去编辑Tar.php并更改了它:
$v_att_list = & func_get_args();
对此:
$v_att_list = func_get_args();
似乎使我更进一步,但现在我得到了:
ERROR: The DSP mailparse.dsp does not exist.
搜索继续....