1

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?

DarkLeafyGreen
  • 69,338
  • 131
  • 383
  • 601
  • `open_basedir` is set, perhaps? – Marc B Feb 28 '11 at 20:29
  • 1
    Safemode isn't the only way that error is triggered. Chances are it is the `open_basedir`, and I doubt any shared hosting would modify it, but you can always ask. – Jim Feb 28 '11 at 20:30

4 Answers4

4

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

edorian
  • 38,542
  • 15
  • 125
  • 143
0

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...

Gelmir
  • 1,829
  • 1
  • 18
  • 28
  • A lot of servers set the `open_basedir` for security. More information on it: http://blog.php-security.org/archives/72-Open_basedir-confusion.html – Jim Feb 28 '11 at 20:33
  • I know :) I was pointing the source of problem, thats it. – Gelmir Feb 28 '11 at 21:34
0

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

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.

mario
  • 144,265
  • 20
  • 237
  • 291