dongwei9771 2016-10-29 11:39
浏览 97

SSL例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败

I started receiving error messages a few days and the problem was pointed to this code.

  function doUpload( $cid, $item )
 {
   $torrent = tempnam( '/tmp', 'articles' );

   $handler = fopen( $articles, 'w' );

   $fgetfiles = file_get_contents( ( string ) $item -> enclosure -> attributes() -> url);

   fwrite( $handler,  $fgetfiles );

   fclose( $handler );    

   $description = ( string ) $item -> description;

The error messages I received were

file_get_contents(): Failed to enable crypto in line 77 

the line 77 is shown below

$fgetfiles = file_get_contents( ( string ) $item -> enclosure -> attributes() -> url);

So this were the changes I made after I got this error:

  1. I downloaded a CA_Bundle cert and added the path inside php.ini Restarted the server and run the code again but error was still there..

  2. I disabled verification of SSL, by adding the code below, but that failed as well.

    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

  3. Enabled SSL Verification by adding the cert to directory in which script is located and set verification to true but same errors.

    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);

    curl_setopt($ch, CURLOPT_CAINFO, dirname(FILE) . '/cacert.pem');

I would like to know if there is something I'm not doing right here because the errors I keep receiving are always the same regardless of the changes I make and it all points to

$fgetfiles = file_get_contents( ( string ) $item -> enclosure -> attributes() -> url); //Line 77

I'm currently running this on Nginx + PHP-FPM. Any help would be appreciated.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 在获取boss直聘的聊天的时候只能获取到前40条聊天数据
    • ¥20 关于URL获取的参数,无法执行二选一查询
    • ¥15 液位控制,当液位超过高限时常开触点59闭合,直到液位低于低限时,断开
    • ¥15 marlin编译错误,如何解决?
    • ¥15 有偿四位数,节约算法和扫描算法
    • ¥15 VUE项目怎么运行,系统打不开
    • ¥50 pointpillars等目标检测算法怎么融合注意力机制
    • ¥20 Vs code Mac系统 PHP Debug调试环境配置
    • ¥60 大一项目课,微信小程序
    • ¥15 求视频摘要youtube和ovp数据集