14

I have XAMPP on Windows7. after update the pear.php.net channel with:

pear channel-update pear.php.net

and try for installing new packages, for example pecl install zmq , encountered with following message and can not install any package:

Connection to 'ssl://pecl.php.net:443' failed: Unable to find the socket 
transport "ssl" - did you forget to enable it when you configured PHP?

I very searched in net and tried to solve it but cannot resolve it. can anyone help me for resolve that and what is the reason?

msoa
  • 1,339
  • 3
  • 14
  • 33
  • 1
    which php modules do you have installed? `php -m` – cweiske Aug 06 '15 at 11:29
  • @cweiske `openssl` and other. Do write those packages name? So that i commented in next post, now the issue is in `pecl search package_name` !!! – msoa Aug 06 '15 at 11:41
  • @cweiske openssl is not required for me, but even i disabled **openssl** it but have not effect. – msoa Aug 06 '15 at 11:51

6 Answers6

27

recently I faced this issue with macOS Sierra with XAMPP 7.0

I updated pecl channel wiht

sudo pecl channel-update pecl.php.net

and then I was getting

Connection to `ssl://pecl.php.net:443' failed:

My solution is as below

run php -r "print_r(openssl_get_cert_locations());"

check default_cert_file path

then download certificate from http://curl.haxx.se/ca/cacert.pem rename it and place it at default_cert_file path

then try pecl list-all

it should work fine

chintan adatiya
  • 1,233
  • 14
  • 17
  • 2
    For XAMPP For XAMPP /Applications/XAMPP/xamppfiles/share/openssl at this path i added file – Abhishek Jan 12 '18 at 10:20
  • 2
    I'm not sure how secure the provided solution is, anyway, another (safe) solution is to update your OpenSSL, if you are using homebrew on mac, all you need to do is to issue `brew reinstall openssl`. – Ahmad Sep 29 '19 at 10:15
  • OMG thank you!! This worked on my Ubuntu 16.04 installation. I had upgraded my openSSL and got the new certs but nothing worked! Awesome fix :) – Michael Fever Oct 18 '19 at 15:44
  • You may need to restart `apache` service after applying the solution above, as I needed to do. – Abdul Rahman Kayali Aug 11 '20 at 10:50
8

In my mac, and based of chintan reply, I did it:

/Applications/XAMPP/bin/php -r "print_r(openssl_get_cert_locations());"

... to show the default_cert_file

Array
(
    [default_cert_file] => /Applications/XAMPP/xamppfiles/share/openssl/cert.pem
    [default_cert_file_env] => SSL_CERT_FILE
    [default_cert_dir] => /Applications/XAMPP/xamppfiles/share/openssl/certs
    [default_cert_dir_env] => SSL_CERT_DIR
    [default_private_dir] => /Applications/XAMPP/xamppfiles/share/openssl/private
    [default_default_cert_area] => /Applications/XAMPP/xamppfiles/share/openssl
    [ini_cafile] => /Applications/XAMPP/xamppfiles/share/curl/curl-ca-bundle.crt
    [ini_capath] => 
)

Then a get the last version of cacert.pem:

wget http://curl.haxx.se/ca/cacert.pem

And then I moved it to the correct place of default_cert_file:

sudo mv cacert.pem /Applications/XAMPP/xamppfiles/share/openssl/cert.pem
lynx_74
  • 1,633
  • 18
  • 12
5

In XAMPP 7.1 on Windows .bat-files of PECL and PEAR may be reason way SSL not work. If in place command php peclcmd.php list-all work for you, then this may because you use correct php.ini file. Just add option -c "%PHP_PEAR_BIN_DIR%\php.ini" to in .bat-file command (your php.ini may be in another path). It's hold be in :RUN section.

Laraan Dragon
  • 51
  • 1
  • 2
4

This is a bug that happens in combination of PEAR 1.9.x with PHP 5.5+.

Please upgrade to PEAR 1.10.0dev1 (or the latest 1.10.0dev2) which fixes this issue.

cweiske
  • 30,033
  • 14
  • 133
  • 194
  • I upgraded the to **PEAR 1.10.0dev2** and restart the **apache** but the issue remained. `pear version` **:** `PEAR Version: 1.10.0dev2 - PHP Version: 5.5.19` – msoa Aug 06 '15 at 11:03
  • After restart the windows i noticed that `pecl install package_name` works, but when searching package `pecl search package_name` i get the error: `Connection to 'ssl://pecl.php.net:443' failed: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? ` !!!!!!!!! – msoa Aug 06 '15 at 11:36
3

For me on Windows 10 in %PHP_PEAR_BIN_DIR%\pecl.bat, the line starting "%PHP_PEAR_PHP_BIN%" -C -n -d; removing the "-n" worked for me.

Reado
  • 1,412
  • 5
  • 21
  • 51
1

None of the above worked for me on my 2021 m1 MacbookPro with OSX 12.4. However, when I executed php -r "print_r(openssl_get_cert_locations());", I also got two extra paths:

[ini_cafile] => /usr/local/etc/openssl@1.1/cert.pem
[ini_capath] => /usr/local/etc/openssl@1.1/certs

I had to (sudo) create the ini_cafile directory and then copy in the http://curl.haxx.se/ca/cacert.pem file renaming it to cert.pem. Then I updated the permissions on the directory and contents.

It seems that on my OSX Installation, [ini_cafile] is used, not [default_cert_file].

After that pecl worked again.

jmux
  • 184
  • 4
  • 17