We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28173
    • 409 Posts
    Hi,

    On a modx revo website, I have this warning on the modx logs :
    PHP warning: curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set


    Google is not very helpfull on it, and I'm asking myself what can I do to solve it and if it's important to solve it...
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      cURL fetches content from a given URL. This may be text like a web page's HTML, or streamed binary files like images or zip archives. In the case of downloading some files, the URL given is actually a redirect to some other location. For example, the download for the MODX zip archive is redirected to the Amazon repository where the MODX files are stored. In other cases, images and other site files may actually be served from a CDN like CloudFlare.

      The cURL option FOLLOWLOCATION will attempt to follow such redirects, but as the warning message states, PHP will not allow this if open_basedir is set in the PHP configuration.

      If the site appears to still be functioning as expected, this is probably because a fallback has been coded into the application using the cURL request. If the FOLLOWLOCATION fails, a different method is used to get the file from the second, real, location. But the attempt was made, triggering that PHP warning. In such a case, it's annoying, but not fatal.

      If the site is actually breaking, the files are not being fetched at all, then it's a bigger problem. There are three possible solutions. Get the sotfware trying to fetch the file fixed to have a fallback to work around the problem, have the PHP configuration modified to disable open_basedir, or move to a hosting provider that your site can work on.

      If you like, there is some good discussion here http://stackoverflow.com/questions/6918623/curlopt-followlocation-cannot-be-activated [ed. note: sottwell last edited this post 10 years, 10 months ago.]
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 3749
        • 24,544 Posts
        If this is a production site, you should change the error reporting level so PHP doesn't issue E_NOTICE warnings.

        The warning may be coming from package manager when it attempts to use cURL to check for updates to MODX extras. You can find out by clearing the error log, then visiting just the Package Manager screen, then checking the error log again.
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 18373 ☆ A M B ☆
          • 3,141 Posts
          Most hosts I've worked with set open_basedir restrictions when a site is on a temporary url (typically the IP or IP/~user/), in which case the problem would be fixed when it gets assigned to a real domain.
            Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

            Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.