I have a script which uses CURL to create a database using CPANEL.
But it is giving the following error message:

Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /home/aquarius/public_html/createdb/includes/ecurl.class.php on line 35

It is not an issue with Safe mode as safe mode is off. The error is with '....open_basedir is set'

I found a (I think) relevant post at this site:

The relevant section of code within ecurl.class.php is given below:

function configCurl($option, $value){
       return curl_setopt ($this->curl, $option, $value);

Commenting out the return statement does not make the script work. Can someone please help me with this, to make the script work.


here's my working cURL code. feel free to use it. This code will log in to a site and set the cookies. Without seeing the rest of your code, it's hard for me to see what's going on.

$cookie_file_path = "cookies/cookiejar.txt"; // Please set your Cookie File path
$fp = fopen("$cookie_file_path","w") or die("<BR><B>Unable to open cookie file $mycookiefile for write!<BR>");
    $LOGINURL = "http://www.insertsitehere.com/asp/logon.asp";
    $postfields = 'user=username&Passwd=yourpassword';
    $agent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)";
        $ch = curl_init(); 
        curl_setopt($ch, CURLOPT_URL,$LOGINURL);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS,$postfields);
        curl_setopt($ch, CURLOPT_USERAGENT, $agent);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
        curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
        $result = curl_exec ($ch);
echo "Logged in";
commented: concise answer to the problem +1

my code uses post fields to set the username and password.

you could take out the POST code and then set the URL in my code on line #7