Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Shell Cakephp httpsocket ssl不';不要使用控制台外壳_Shell_Cakephp_Ssl_Console - Fatal编程技术网

Shell Cakephp httpsocket ssl不';不要使用控制台外壳

Shell Cakephp httpsocket ssl不';不要使用控制台外壳,shell,cakephp,ssl,console,Shell,Cakephp,Ssl,Console,我正在尝试使cakephp shell使用httpsocket和ssl 我的“草莓人”贝壳: 现在,我不指望谷歌会做出成功的回应,因为在这个简单的测试中,我没有提供必要的参数 但我得到的是:错误@找不到套接字传输“ssl”-您在配置php时忘记启用它了吗? 我没有,openssl已启用,为了证明这一点,它可以工作: App::uses('AppController', 'Controller'); App::uses('HttpSocket', 'Network/Http'); class S

我正在尝试使cakephp shell使用httpsocket和ssl

我的“草莓人”贝壳:

现在,我不指望谷歌会做出成功的回应,因为在这个简单的测试中,我没有提供必要的参数

但我得到的是:
错误@找不到套接字传输“ssl”-您在配置php时忘记启用它了吗?

我没有,openssl已启用,为了证明这一点,它可以工作:

App::uses('AppController', 'Controller');
App::uses('HttpSocket', 'Network/Http');

class StrawmanController extends AppController {

public function index() {
    // STRAWMAN
    $httpSocket = new HttpSocket();
    $results = $httpSocket->post(
        'https://accounts.google.com/o/oauth2/token',
        'foo=bar'
    );
    debug($results);   
}  
}
(所谓工作,我指的是以“无效请求”回应。)

总而言之:当我通过控制器或模型使用openssl时,它是有效的,而不是通过控制台

有人知道为什么吗?我怎样才能让它工作


谢谢!控制台PHP和web PHP通常是不同的。 两者都有不同的PHP.ini文件,因此导致在CLI中未启用某些模块,您认为通过web界面这些模块是理所当然的

确保找到了适合CLI的PHP.ini,并在那里启用SSL模块openssl。

构建在的答案之上

$httpSocket = new HttpSocket();
$request = array(
         'method' => 'POST',
         'uri' => array(
                    'schema' => 'https',
                    'host' => 'www.samplewebsite.com',
                    'path' => 'put/your/path/here'
                    )
     );
$result = $httpSocket->request($request);
查看openssl
*nix
发行版

 php -r "phpinfo();" | grep ssl

对于windows,我猜它在
php.ini

PS中被称为
php\u openssl.dll
:这两种方法都可以正常工作http://Correct! 一旦我知道要查找什么,
php--ini
告诉我,在这台笔记本电脑上有第三个php.ini文件,我忘记了,但它没有打开opensll。请注意:在同一台机器上同时安装xampp和wamp的风险由您自己承担,并且只有在您获得报酬时才这样做!
 php -r "phpinfo();" | grep ssl