Unable to find the wrapper https windows

I am trying to install Composer for Windows using the command line with the following call:

php -r «readfile(https://getcomposer.org/installer);» | php

However, I get this error message:

Warning: readfile(): Unable to find the wrapper «https» — did you forget to enable it when configured PHP? in Command line code on line 1

Call Stack:
0.0010 224336 1. {main}() Command line code:0
0.0010 224488 2. readfile() command line code:1

Warning: readfile(https://getcomposer.org/installer): failed to open stream: invalid argument in Command line code on line 1

Call Stack:
0.0010 224336 1. {main}() Command line code:0
0.0010 224488 2. readfile() Command line code:1

I have already uncommented the «;extension=php_openssl.dll» line in the php5.5.12 directory, restarted the browser, and tried other variants. When I run the command with just the ‘s’ in https dropped, I get:

Some settings on your machine make Composer unable to work properly. Make sure that you fix the issues listed below and run this script again:

The openssl extension is missing, which means that secure HTTPS transfers are impossible. If possible you should enable it or recompile php with —with-openssl

I’ve tried including this —with-openssl flag at various places but it doesn’t seem to be doing the trick.

Like people say, check with the configuration.

phpinfo.php

<?php
phpinfo();
?>

Search for OpenSSL on the webpage.
Also, don’t forget to restart the WebServer after altering the php.ini file.

If you can’t use file_get_contents(), use cURL instead if available, it’s better in many ways and faster.

function url($url,$option = null) {

    $cURL = curl_init();

    if ($option) {
        curl_setopt($cURL, CURLOPT_URL, $url.$option);
    } else {
        curl_setopt($cURL, CURLOPT_URL, $url);
    }

    curl_setopt($cURL, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($cURL, CURLOPT_AUTOREFERER, 1);
    curl_setopt($cURL, CURLOPT_HTTPGET, 1);
    curl_setopt($cURL, CURLOPT_VERBOSE, 0);
    curl_setopt($cURL, CURLOPT_HEADER, 0);
    curl_setopt($cURL, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($cURL, CURLOPT_SSL_VERIFYPEER, 1);
    curl_setopt($cURL, CURLOPT_SSL_VERIFYHOST, 1);
    curl_setopt($cURL, CURLOPT_DNS_USE_GLOBAL_CACHE, 0);
    curl_setopt($cURL, CURLOPT_DNS_CACHE_TIMEOUT, 2);

    $output['page'] = curl_exec($cURL);
    $output['contentType'] = curl_getinfo($cURL, CURLINFO_CONTENT_TYPE);

    curl_close($cURL);

    return $output;

}

$page = url('https://example.com/','i/like/subfolders');

Проблема в вопросе. Я провел тщательное исследование решений в отношении этого, и я знаю, что есть темы для этого, и я следил за ними тоже, и ничего не сработало. Это, как говорится, я точно перечислю все, что я сделал до сих пор. Я запускаю PHP 5.2.14 с Zend Debugging в последней версии Eclipse на моем компьютере под управлением Windows XP. У меня 1 ГБ ОЗУ. У меня XAMPP работает с Apache, MySQL и FileZilla.

В XAMPP я сделал следующее (во время этих изменений Apache отключился):
Нажмите «Администратор» с панели управления XAMPP и перешел к https:// localhost/xampp/. Оттуда я принял сертификаты из этой строки на странице приветствия:

Для поддержки OpenSSL используйте тестовый сертификат с https://127.0.0.1 или https://localhost.

В этом же разделе я проверил phpinfo(). В разделе «Окружающая среда» SERVER["HTTPS"] есть on. В разделе «Apache Environment» HTTPS находится on. В разделе «Переменные PHP» _SERVER["HTTPS"]on. В разделе «Phar» OpenSSL support есть disabled (установить ext/openssl). Я не знаю, как включить Phar.

Теперь о самих файлах в C:\xampp, я пошел в папку PHP. Под производством и разработкой файлов php.ini(лучше безопасно, чем извините) у меня есть allow_url_fopen=On, allow_url_include=On, и я удалил точку с запятой, так что extension=php_openssl.dll больше не комментируется. Я даже подтвердил, что .dll находится в папке ext папки PHP. Оба файла libeay32.dll и ssleay32.dll находятся в папках PHP и Apache. Папка Apache не содержит файлов производительности или разработки php.ini.

Я пошел в http://www.slproweb.com/products/Win32OpenSSL.html и установил Win32 OpenSSL v1.0.0d для безопасной меры.

Теперь строка кода, о которой идет речь в моем файле retrieve_website.php, выглядит следующим образом:

$urlquery = "https://www.googleapis.com/customsearch/v1?key=".$appid."&cx=".$google_searchid."&q=".$query."&alt=atom&num=".$results;
$xmlresults = file_get_contents($urlquery);

У меня есть два других веб-сайта, которые я запрашиваю, но они обслуживаются через HTTP, и они работают нормально. У меня также есть эта строка кода, введенная в конце script:

echo 'openssl: ',  extension_loaded  ('openssl') ? 'yes':'no', "\n";
echo 'http wrapper: ', in_array('http', $w) ? 'yes':'no', "\n";
echo 'https wrapper: ', in_array('https', $w) ? 'yes':'no', "\n";
echo 'wrappers: ', var_dump($w);

Когда я запускаю его как PHP Script в Eclipse, все выводится отлично, как я хочу, с этими результатами:

openssl: yes
http wrapper: yes
https wrapper: yes
wrappers: array(10) {
  [0]=>
  string(5) "https"
  [1]=>
  string(4) "ftps"
  [2]=>
  string(3) "php"
  [3]=>
  string(4) "file"
  [4]=>
  string(4) "data"
  [5]=>
  string(4) "http"
  [6]=>
  string(3) "ftp"
  [7]=>
  string(13) "compress.zlib"
  [8]=>
  string(14) "compress.bzip2"
  [9]=>
  string(3) "zip"
}

Несмотря на все эти изменения, которые я сделал (после того, как я запустил Apache), я все равно получаю те же ошибки при первом доступе к моему PHP Script в Eclipse и Firefox через http://localhost/tutorial/retrieve_website.php:

Предупреждение: file_get_contents() [function.file-get-contents]: Не удалось найти оболочку «https» — вы забыли включить ее при настройке PHP? в C:\xampp\htdocs\tutorial\retrieve_website.php в строке 29

Предупреждение: file_get_contents (https://www.googleapis.com/customsearch/v1?key=removed ИД API & cx = удаленный идентификатор поиска & q = + Devil + go + down + to + Georgia & alt= atom & num = 5) [function.file-get-contents]: не удалось открыть поток: нет такого файла или каталога в C:\xampp\htdocs\tutorial\retrieve_website.php в строке 29

Предупреждение: DOMDocument:: loadXML() [domdocument.loadxml]: пустая строка, предоставленная в качестве входа в C:\xampp\htdocs\tutorial\retrieve_website.php в строке 33

openssl: no http wrapper: yes https wrapper: no wrappers: array (10) {[0] = > string (3) «php» [1] = > string (4) «file» [2] = > string (4 ) «glob» [3] = > строка (4) «данные» [4] = > строка (4) «http» [5] = > строка (3) «ftp» [6] = > строка (3) «zip» [7] = > string (13) «compress.zlib» [8] = > string (14) «compress.bzip2» [9] = > string (4) «phar» }

Что я забыл или не сделал? Насколько я знаю, я сделал все, что я исследовал относительно HTTPS и OpenSSL

4b9b3361

Ответ 1

Я решил его в XAMPP, раскомментировав ;extension=php_openssl.dll в /apache/bin/php.ini, несмотря на то, что phpinfo() сказал мне, что /php/php.ini был загруженным ini файлом.

EDIT: Я думаю, что ответ Ezra — лучшее решение, непосредственно добавляющее линию расширения к соответствующему ini файлу.

Ответ 2

Мне пришлось добавить extension=php_openssl.dll в мой php.ini файл, расположенный в xampp/php/php.ini. Как-то его там не было, добавив его и перезапустив Apache, все работало нормально.

Ответ 3

просто добавьте две строки в файл php.ini.

extension=php_openssl.dll
allow_url_include = On

его работа для меня.

Ответ 4

Ваш Apache, вероятно, не скомпилирован с поддержкой SSL. В любом случае используйте cURL вместо file_get_contents. Попробуйте этот код, если он терпит неудачу, тогда я прав.

function curl_get_contents($url)
{
  $curl = curl_init($url);
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
  curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
  curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
  $data = curl_exec($curl);
  curl_close($curl);
  return $data;
}

Ответ 5

Я включил расширение openssl, и он работает для меня:)

; extension = php_openssl.dll

к

расширение = php_openssl.dll

Ответ 6

В моем случае проблема возникла из-за WAMP с использованием другого php.ini для CLI, чем Apache, поэтому ваши настройки, выполненные в меню WAMP, не применяются к CLI. Просто измените CLI php.ini, и он работает.

Ответ 7

в OpenSuse 12.1 требуется только следующее:

zypper in php5-openssl

Ответ 8

Мне пришлось раскомментировать эти строки в php.ini:

extension=php_openssl.dll
extension_dir = "ext"

«ext» применимо, если php_openssl.dll находится в папке «ext».

Примечание: Я должен был сделать это для двух моих файлов php.ini, иначе это не сработало бы. Один находится в папке установки vs.php, а другой — в папке PHP

C:\Program Files (x86)\Jcx.Software\VS.Php\2013\Php 5.6
C:\Program Files (x86)\PHP\v5.6

Источник

Ответ 9

В MAC AMPPS я обновил php-5.5.ini следующим образом и теперь он работает.

allow_url_include = On
extension=openssl.so

Ответ 10

Вместо этого вы можете использовать эту функцию.

function get_url_contents($url){  
  if (function_exists('file_get_contents')) {  
    $result = @file_get_contents($url);  
  }  
  if ($result == '') {  
    $ch = curl_init();  
    $timeout = 30;  
    curl_setopt($ch, CURLOPT_URL, $url);  
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);  
    $result = curl_exec($ch);  
    curl_close($ch);  
  }  

  return $result;  
}

Ответ 11

PHP7, в файле php.ini удалите «;» до extension=openssl

Ответ 12

Проблема с file_get_contents для запросов https в Windows, раскомментируйте следующие строки в файле php.ini:

extension=php_openssl.dll
extension_dir = "ext"

Ответ 13

После того, как я следил за ним весь день, я понял ответ благодаря этому руководству:
http://piwigo.org/forum/viewtopic.php?id=15727

В основном под Eclipse → Windows → Preferences → PHP Executables, есть раздел, на котором ссылаются .exe и .ini. По умолчанию они были в каталоге Eclipse, когда вы устанавливаете функцию SDK для инструментов разработки PHP из Eclipses Install New Software в меню справки.

Поэтому вместо этого я добавил новый исполняемый файл под названием PHP 5.3.5 (CGI) и ссылался на cgi.exe и .ini из папки xppp php.

Спасибо, webarto за то, что уделили вам время, чтобы помочь мне.

Ответ 14

Я использую opsenSUSE Leap, и у меня была такая же проблема — это означает отсутствие поддержки OpenSSL. Вот как я это решил:

  • Открыть YaST.
  • Перейдите в раздел Управление программным обеспечением.
  • В окне поиска на левой панели введите «php5-openssl» и нажмите клавишу возврата.
  • Установите флажок рядом с «php5-openssl» на правой панели, чтобы выбрать его, и нажмите «Принять» (это добавляет поддержку OpenSSL).
  • Перезапустить Apache: sudo service apache2 restart

Чтобы это сделать, вы закончили.

Ответ 15

Попробуйте это:

function curl($url){
    $curl = curl_init($url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
    $buffer = curl_exec($curl);
    curl_close($curl);
    return $buffer;
}

Ответ 16

Я тоже получил эту ошибку. Я понял, что в моей версии PHP не было скомпилировано openssl, поэтому просто добавить директиву расширения в php.ini было недостаточно. Я не знаю, как вы должны решить это в своем конкретном случае, но для меня я использую macports, и команда была просто:

sudo port install php5-openssl

Ответ 17

Для тех, кто использует Winginx (на основе nginx вместо Apache), я исправил это с помощью 4 шагов:

  1. В меню «Инструменты» нажмите «Настройка Winginx PHP5» (не говоря уже о 5 в названии…):

    Winginx PHP5 Config

  2. Выберите версию PHP, которую вы хотите изменить в php.ini:

    PHP version selection

  3. На вкладке Расширения PHP выберите расширение php_openssl и нажмите кнопку Сохранить:

    php_openssl selection

  4. перезапустите соответствующий сервис PHP через панель задач (Stop и Start):

    Restart PHP service

Ответ 18

Если вы используете сервер wamp, перейдите к значку, нажмите на этот wamp server icon click on this

Затем перейдите в PHP, затем нажмите на расширение PHP, там будет необходимо активировать php_openssl и перезапустить сервер wamp active php_openssl from here

Ответ 19

В моем случае (PHP 7.3 в Windows в режиме FastCGI) это было раскомментировано extension=openssl.
Не расширение =php_ openssl, как большинство людей публикуют здесь.

(То же самое было опубликовано здесь, но без подробностей об ОС, что может быть ключевым отличием здесь.)

Ответ 20

Внутри simple_html_dom.php измените значение переменной $offset с -1 на 0.
эта ошибка обычно возникает при переходе на PHP 7.

HtmlDomParser::file_get_html использует смещение по умолчанию -1, передача в 0 должна решить вашу проблему.

Answer by Dayana Shaw

1

I mean I got the error message «Unable to find the wrapper “https” — did you forget to enable it when you configured PHP?» and resolved it by entering «zypper in php5-openssl» at the command line. That fixed the error.

– TheSatinKnight

Oct 9 ’14 at 4:26

,

Meta Stack Overflow

,Stack Overflow en español,Stack Overflow em Português

just add two lines in your php.ini file.

extension=php_openssl.dll
allow_url_include = On

Answer by Zoe Cohen

solved it in XAMPP by uncommenting ;extension=php_openssl.dll in 
/apache/bin/php.ini despite 
phpinfo() telling me /php/php.ini 
was the loaded ini file.
  
And You just uncomment the extension_dir in php.ini  

Answer by Ares Buchanan

Warning: fopen() [function.fopen]: Unable to find the wrapper “https” — did you forget to enable it when you configured PHP?,I have an order form that goes to UPS and gets various prices for different shipping options. Here’s the basic code that I use to do that:,Did I leave something out when I configured PHP?,No openssl and no curl. I searched the page for “openssl” and only found these two references to it, under “Phar”:

I have an order form that goes to UPS and gets various prices for different shipping options. Here’s the basic code that I use to do that:


$xml = arbitrary_xml_building_function();
$stream_params = array(
	'http' => array(
		'method' => 'POST',
		'header' => 'Content-Type: application/x-www-form-urlencoded',
		'content' => $xml
	)
);
$ctx = stream_context_create($stream_params);
$fp = fopen('https://wwwcie.ups.com/ups.app/xml/Rate', 'r', false, $ctx);
$response = stream_get_contents($fp);
fclose($fp);
$response = simplexml_load_string($response);
return $response;


Answer by Sasha Acevedo

To solve this error, you need to install the OpenSSL package for PHP on your webserver.,and restart the webserver. The error should be resolved.,On a FreeBSD server, you may need to install the following package: php53_openssl and restart your webserver.,On a Windows server, open your php.ini config file and simply uncomment the following line:

On a Windows server, open your php.ini config file and simply uncomment the following line:

;extension=php_openssl

Answer by Lorelei Bauer

Example: file could not be downloaded: Unable to find the wrap per «https» — did you forget to enable it when you configured PHP? failed to open stream: No such file or directory

solved it in XAMPP by uncommenting ;extension=php_openssl.dll in 
/apache/bin/php.ini despite 
phpinfo() telling me /php/php.ini 
was the loaded ini file.
  
And You just uncomment the extension_dir in php.ini

Answer by Estella Cameron

PHP may tell you the following:
,
Edit your php.ini file and add the following line:

PHP may tell you the following:

PHP Warning: file_get_contents():
Unable to find the wrapper "https" - did you forget
to enable it when you configured PHP?

Edit your php.ini file and add the following line:

extension=php_openssl.dll

Заставляем Denwer поддерживать HTTPS

Безопасный протокол HTTPS сегодня нужен всё чаще при программировании web-приложений. В комплекте Denwer, устанавливаемом по умолчанию, попытавшись вызвать локальной скрипт через HTTPS, мы видим обычно лишь следующее:

Warning: file_get_contents(): Unable to find the wrapper «https» — did you forget to enable it when you configured PHP? in Z:\home\localhost\www\https.php on line 3

Warning: file_get_contents(https://www.google.com/): failed to open stream: Invalid argument in Z:\home\localhost\www\https.php on line 3

Это был результат выполнения на локалхосте Denwer скрипта

<?php
 error_reporting(E_ALL);
 $file = file_get_contents('https://www.google.com/');
 die($file);
?>

Как решить проблему с настройкой протокола HTTPS на Denwer?

1. Выясняем, какой именно файл php.ini подключён, например, запустив на локальном хосте следующий скрипт

<?php
 phpinfo();
?>

и прочитав ответ в строке Loaded Configuration File первой таблицы с данными. С версии PHP 5.2.4 и выше поможет и просто

<?php
 echo php_ini_loaded_file();
?>

Для Denwer в норме должно получиться Z:\usr\local\php5\php.ini

2. В нужном файле php.ini ищем и раскомментируем (удалим из первой позиции точку с запятой) строку вида

;extension=php_openssl.dll

3. Если в папке дополнений (при запущенном Denwer это обычно папка Z:\usr\local\php5\ext\, при условии, что вы не конфигурировали сервер по-другому) есть файл php_openssl.dll, то идём к п. 5 :)

Иначе качаем вот отсюда пакет расширений (потребуется ввести адрес E-mail, на который придёт ссылка для скачивания).

4. Установщик пакета кривоват, особенно под новыми Windows, проще его открыть как архив обычным WinRAR или 7Zip и извлечь нужный файл в папку Z:\usr\local\php5\ext\ — путь от корня архива тоже будет \usr\local\php5\ext\php_openssl.dll.

5. Перезагружаем компьютер и перезапускаем Denwer, теперь первый скрипт успешно (с точноcтью до кодировки) показал содержимое главной страницы Google на локалхосте, при этом содержимое получено обычной функцией file_get_contents.

Не забудьте также, что пользоваться устаревшей версией PHP 5.3 совсем необязательно, привычный Denwer легко заставить работать и с PHP 5.5.

21.11.2016, 17:57 [19558 просмотров]


  • Unable to find file graphics system windows
  • Ultraiso не устанавливается на windows 10
  • Ultraiso не создает виртуальный привод в windows 10
  • Unable to find bundled java version flutter windows
  • Ultravnc authentication rejected windows 10