Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-14126

HttpClient.php library used by CiviCRM issues a PHP warning when open_basedir is set

    Details

    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None

      Description

      We receive this error very frequently in the logs of all clients who are hosted in hosts where the php.ini setting open_basedir is active:

      TYPE php
      DATE Monday, December 23, 2013 - 15:52
      USER username
      LOCATION https://site.ca/fr/civicrm?reset=1
      REFERRER https://site.ca/fr
      MESSAGE Warning: curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set in CRM_Utils_HttpClient->createCurl() (line 192 of /var/www/vhosts/site.ca/httpdocs/sites/all/modules/civicrm/CRM/Utils/HttpClient.php).
      SEVERITY warning

      This error occurs on the front page of civicrm, on the extensions page I think and also when using some of the core payment processors that are using curl.

      It is a minor warning that is not stopping anything from working but it does fill up the logs. it also means that if a redirect was actually needed then it wouldn't work. We did quite a bit of research to see if there are any other settings we could change to avoid this while still leaving open_basedir activated but didn't find a settings based solution.

      The only solutions found indicate the need to modify the Http Client code using a manually coded redirect (if needed) such as:
      http://slopjong.de/2012/03/31/curl-follow-locations-with-safe_mode-enabled-or-open_basedir-set/
      http://www.web-development-blog.com/archives/curl-follow-url-location-while-open_basedir-is-set/

      One option might be to move away from using the Pear library and use this client library which will apparently be used by Drupal 8:
      http://docs.guzzlephp.org/en/latest/

      I did a search of the github code for Guzzle and it does not appear to use CURLOPT_FOLLOWLOCATION.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              lola_slade Lola Slade
            • Votes:
              1 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

              • Created:
                Updated: