在使用 curl 时出现报错:

CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set in ...

"CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set" 问题

 

 

safe_mode:PHP安全模式,当开启时一些PHP函数将被禁用

open_basedir:   将用户访问文件的活动范围限制在指定的区域  如 open_basedir=.:/tmp 或是具体 /var/tmp

解决方法:

if (ini_get('open_basedir') == '' && ini_get('safe_mode' == 'Off')) {

    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);

}

 

 

相关文章:

  • 2021-08-08
  • 2022-12-23
  • 2021-07-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-24
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-18
  • 2022-12-23
  • 2021-05-29
相关资源
相似解决方案