duangu3620 2017-02-10 13:23
浏览 130

通过Laravel 5.2连接Mongodb时出错

Getting ssl error while connecting monogoDb from laravel 5.2. Added the connection string in config/database.php file. I used jenssegers/mongodb.

Here is the configuration :

 'connections' => [
    'mongodb' => [
        'driver' => 'mongodb',
        'host' => ['hostname'],
        'port' => 'port',
        'database' => 'xxxx',
        'username' => 'xxxx',
        'password' => 'xxxx',
        'options' => [
            'ssl' => 'true',
            'db' => 'xxx'
        ],
        'driver_options' => [
            'context' => stream_context_create([
                'ssl' => [
                   'local_cert' =>  public_path().'/xxx.pem',
                   'cafile' => public_path().'/xxx.pem',
                    'allow_self_signed' => true,
                    'verify_peer' => true,
                    'verify_peer_name' => true,
                    'verify_expiry' => true,
                ]
            ])
        ]
    ]
],

And changed default connection in database.php

'default' => env('DB_CONNECTION', 'mongodb')

Whenever i tried this am getting the response like:Failed to connect to: Cannot setup SSL, is ext/openssl loaded?. openssl and ssl support are enabled in phpinfo().

Is there a way to solve it out?

Thanks

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 素材场景中光线烘焙后灯光失效
    • ¥15 请教一下各位,为什么我这个没有实现模拟点击
    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 保护模式-系统加载-段寄存器