Some users who are attempting to upgrade to PHP 5.6 have seen messages in their Drupal status reports (Status > Reports) similar to the following:

HTTP request status Fails Your system or network configuration does not allow Drupal to access web pages, ... [additional information cut]... you may add '$conf['drupal_http_request_fails'] = FALSE; to the bottom of your settings.php file.

A quick workaround :

function MODULE_http_request($url, &$options) {
  // By default, verify SSL certificates in OpenSSL connections. This is
  // enabled by default in PHP 5.6, older versions do not enable it
  // automatically. Allow other SSL context options to be configured.
  if (!isset($options['context'])) {
    // Parse the URL and make sure we can handle the schema.
    $uri = @parse_url($url);
    $default_conf = array(
      'ssl' => array('verify_peer' => TRUE),
    );
    $opts = variable_get('drupal_ssl_context_options', $default_conf);
    if (in_array($uri['host'], array_keys($opts))) {
      $options['context'] = stream_context_create($opts[$uri['host']]);
    }
    elseif (array_key_exists('default', $opts)) {
      $options['context'] = stream_context_create($opts['default']);
    }
  }
}

function MODULE_update_N() {
  variable_set('drupal_http_request_function', 'MODULE_http_request');
}

// You can override drupal_ssl_context_options through settings.php like comment#68

$conf['drupal_ssl_context_options'] = array(
  'default' => array(
    'ssl' => array(
      'verify_peer' => TRUE,
      'verify_peer_name' => TRUE,
      'allow_self_signed' => FALSE,
    ),
  ),
  'my-self-signed-solr-test-server@example.com' => array(
    'ssl' => array(
      'verify_peer' => FALSE,
      'verify_peer_name' => FALSE,
      'allow_self_signed' => TRUE,
    ),
  ),
);

cf: https://docs.acquia.com/articles/php-56-upgrades-generate-http-request-s...

Comments

brice_gato created an issue. See original summary.

Elin Yordanov’s picture

Status: Needs review » Active

Version: 7.56 » 7.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.