ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Error when calling cURL

January 07, 2010 11:15am

Subscribe [4]
  • #1 / Jan 07, 2010 11:15am

    Stuart Whitman

    27 posts

    I get the following error when calling cURL from one of my templates.

    CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in ../core/core.functions.php(634

    )

    According to PHP info:

    open_basedir    /home/plancars/:/tmp:/usr/local/lib/php/
    safe_mode    Off
    safe_mode_exec_dir    no value
    safe_mode_gid    Off
    safe_mode_include_dir    no value

    I have the same code running on another domain and it works fine and I’m a bit lost as to what I can do now.

    Thanks

  • #2 / Jan 07, 2010 5:17pm

    Ingmar

    29245 posts

    Can you show us a little more of your code? Is this raw PHP? What version and build of EE are you on? That said, are you quite certain that there is no open_basedir restriction in effect?

  • #3 / Jan 07, 2010 5:27pm

    Stuart Whitman

    27 posts

    EE 1.6.8 with MSM. Template is PHP enabled on INPUT.

    {exp:freeform:entries}
    <?
    $email_address = '{x_ff1e}';
    $join_mail = '{joinlist}';
    
    if (isset($join_mail)) {
                    $postfields="email_address=".$email_address;
                    $url = 'http://oi.vresp.com?fid=5724d2d65c';
                    $ch = curl_init();    // initialize curl handle
                    curl_setopt($ch, CURLOPT_URL,$url); // set url to post to
                    curl_setopt($ch, CURLOPT_FAILONERROR, 1);
                    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
                    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable
                    curl_setopt($ch, CURLOPT_TIMEOUT, 3); // times out after 4s
                    curl_setopt($ch, CURLOPT_POST, 1); // set POST method
                    curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields); // add POST fields
                    $result = curl_exec($ch); // run the whole process
                    curl_close($ch); 
                    echo $result;
                    echo 'Your email address ' .$email_address. ' has been added to the Plancars Mailing List as requested. We never pass on your details to other organisations or send SPAM emails.';
    }
    ?>
    {/exp:freeform:entries}

    I don’t know enought about open_basedir but I haven’t knowingly changed anything.

  • #4 / Jan 07, 2010 7:28pm

    Adam Dorsey

    1439 posts

    If you check out PHP info, in Utilities in the CP, what do you have for the line “open_basedir”?

  • #5 / Jan 08, 2010 6:42am

    Stuart Whitman

    27 posts

    Hi Adam,

    Here’s my PHP info

    open_basedir = /home/plancars/:/tmp:/usr/local/lib/php/
    safe_mode = Off
    safe_mode_exec_dir = no value
    safe_mode_gid = Off
    safe_mode_include_dir = no value
  • #6 / Jan 08, 2010 7:23pm

    Adam Dorsey

    1439 posts

    Hmm… I have no value listed in my install. Can you contact your host, and see if you in fact have an open_base_dir restriction?

  • #7 / Jan 09, 2010 8:55am

    Stuart Whitman

    27 posts

    Adam,

    I’m pretty sure thats not the case as I have another domain on the same server running EE 1.3.2 with the same code. All be it not inside the freeform tags. The PHP info between the 2 sites shows the same safe mode and open base values.

    I’ll check anyway.

  • #8 / Jan 10, 2010 4:17pm

    Greg Salt

    3988 posts

    Hi Stuart,

    Your phpinfo() result does show that an open_basedir restriction is in force. Please create another blank template with PHP enabled and try your code outside of Freeform to test whether you get the same response.

    Cheers

    Greg

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases