PHP safe_mode problem using curl

7.8k views Asked by At

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?

4

There are 4 answers

0
edorian On BEST ANSWER

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

2
Gelmir On

Maybe the second part of the error message: or an open_basedir is set

Let me guess, you are using Plesk as control panel? Its Plesk that usually puts open_basedir setting...

0
Dirty Frenchman On

Have you checked both open_basedir as well as safe_mode with ini_get()? They may actually not be turned off or you may have an open_basedir set.

If you're using plesk, this link may help: http://www.linuxweblog.com/plesk-vhost.conf

0
mario On

There are a few workarounds listed in the manual pages for curl: http://www.php.net/manual/en/function.curl-setopt.php#102121

The other workaround would be to use PEAR Http_Request or Zend_Http.