我知道之前已经有人问过这个问题,但我已经遵循了所有指南,但不知何故它仍然不起作用
我将 open_basedir 设置为不在我的域上工作,并将 safe_mode 完全关闭,这里是 phpinfo();打印出两个
safe_mode Off Off
open_basedir /home/proagent/:/home/proagent:/tmp/:/tmp:/usr/local/lib/php/:/home/proagent/domains/xxx.com/bot::/home/proagent/domains/xxx.com/bot/ no value
但是我仍然得到
警告:curl_setopt() [function.curl-setopt]:在安全模式下或在第 58 行/home/proagent/domains/xxx.com/public_html/bot/scrape.php 中设置 open_basedir 时,无法激活 CURLOPT_FOLLOWLOCATION
任何想法都会很好!
最佳答案
只要你有open_basedir
设置,并且您的 phpinfo
输出显示您已设置它(左侧值计数),CURLOPT_FOLLOWLOCATION
将不起作用。注释该行以允许访问所有文件,这是一个 php.ini
示例:
; open_basedir, if set, limits all file operations to the defined directory
; and below. This directive makes most sense if used in a per-directory
; or per-virtualhost web server configuration file. This directive is
; *NOT* affected by whether Safe Mode is turned On or Off.
; http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.open-basedir
;open_basedir =
关于php - 即使设置正确,也无法激活 CURLOPT_FOLLOWLOCATION,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7932225/