PHP safe_mode problem using curl

Upvote picture Upvote · Feb 28, 2011 · Viewed 7.7k times · Source

I want to use cURL on my server, but it gives me the following error

Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot
be activated when in safe_mode or an open_basedir is set in
/www/htdocs/w009663c/download/webapp/browser/pproxy.php on line 180

Warning: Cannot modify header information - headers already sent 
by (output started at /www/htdocs/w009663c/download/webapp/browser/
pproxy.php:180) 
in /www/htdocs/w009663c/download/webapp/browser/pproxy.php on line 242
{"status":{"http_code":301},"contents":""}

I requested the server admin to switch of safe_mode but he says that it is already switched off.

What else could cause this problem?

Answer

edorian picture edorian · Feb 28, 2011

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

I'd assume open_basedir is set then and since that seems to be a shared server i'd assume they are not going to turn that off

Put

<?php 
phpinfo();

into a file and look at the output to see the configuration settings.

Maybe a workaround

Have a look at this comment of the curl-setopt manual:

http://php.net/manual/ro/function.curl-setopt.php#102121

Maybe that workaround works for you