如何启用HTTPS流包装器 [英] How to enable HTTPS stream wrappers

查看:86
本文介绍了如何启用HTTPS流包装器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows系统上安装了php5,并尝试通过命令行控制台执行以下脚本:

I installed php5 on my windows system and tried to execute the following script with a command-line console:

<?php
// load in credentials
$creds = parse_ini_file('/etc/aws.conf');

// Define query string keys/values
$params = array(
    'Action' => 'DescribeAvailabilityZones',
    'AWSAccessKeyId' => $creds['access_key'],
    'Timestamp' => gmdate('Y-m-d\TH:i:s\Z'),
    'Version' => '2008-05-05',
    'ZoneName.0' => 'us-east-1a',
    'ZoneName.1' => 'us-east-1b',
    'ZoneName.2' => 'us-east-1c',
    'SignatureVersion' => 2,
    'SignatureMethod' => 'HmacSHA256'
);

// See docs
// http://tr.im/jbjd
uksort($params, 'strnatcmp');
$qstr = '';
foreach ($params as $key => $val) {
    $qstr .= "&{$key}=".rawurlencode($val);
}
$qstr = substr($qstr, 1);

// Signature Version 2
$str = "GET\n"
     . "ec2.amazonaws.com\n"
     . "/\n"
     . $qstr;

// Generate base64-encoded RFC 2104-compliant HMAC-SHA256
// signature with Secret Key using PHP 5's native 
// hash_hmac function.
$params['Signature'] = base64_encode(
    hash_hmac('sha256', $str, $creds['secret_key'], true)
);

// simple GET request to EC2 Query API with regular URL 
// encoded query string
$req = 'https://ec2.amazonaws.com/?' . http_build_query(
    $params
);
$result = file_get_contents($req);

// do something with the XML response
echo $result;

但是它说它找不到包装器"https",并询问我在配置PHP时是否忘记启用它.

But it says that it's unable to find the wrapper "https" and asks if I forget to enable it when I configured PHP.

问题出在哪里,如何解决?

What is the problem and how to settle it?

推荐答案

1:检查安装了哪些包装器.

1: Check which wrappers are installed.

<?php var_dump(stream_get_wrappers()); ?>

2:如果您没有在列表中看到"https",请从php.ini中添加/取消注释

2: If you dont see "https" on the list, add to/uncomment from php.ini

extension=php_openssl.dll

重新启动服务器*,并完成操作.

Restart your server*, and your done.

*如果服务器无法重新启动,请从某个地方下载php_openssl.dll并将其粘贴在php.ini文件中定义的扩展目录中,重新启动服务器,说几句地狱玛丽,然后祈祷.

*if server fails to restart go download php_openssl.dll from someplace and stick it in your extensions directory defined in the php.ini file, restart server, say a few hell mary's and pray.

这篇关于如何启用HTTPS流包装器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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