asdf-php icon indicating copy to clipboard operation
asdf-php copied to clipboard

MacOS: Unable to find the wrapper "https"

Open tylerlwsmith opened this issue 1 year ago • 9 comments

Provide environment information

OS:
Darwin My-MacBook-Pro.local 23.1.0 Darwin Kernel Version 23.1.0: Mon Oct  9 21:33:00 PDT 2023; root:xnu-10002.41.9~7/RELEASE_ARM64_T6031 arm64

SHELL:
zsh 5.9 (x86_64-apple-darwin23.0)

BASH VERSION:
3.2.57(1)-release

ASDF VERSION:
v0.13.1-0586b37

ASDF INTERNAL VARIABLES:
ASDF_DEFAULT_TOOL_VERSIONS_FILENAME=.tool-versions
ASDF_DATA_DIR=/Users/tyler/.asdf
ASDF_DIR=/Users/tyler/.asdf
ASDF_CONFIG_FILE=/Users/tyler/.asdfrc

ASDF INSTALLED PLUGINS:
elixir                       https://github.com/asdf-vm/asdf-elixir.git master a4c42e1
erlang                       https://github.com/asdf-vm/asdf-erlang.git master aaa3ee7
nodejs                       https://github.com/asdf-vm/asdf-nodejs.git master c5b7c40
php                          https://github.com/asdf-community/asdf-php.git master 1eaf4de
ruby                         https://github.com/asdf-vm/asdf-ruby.git master b3d44de

To Reproduce

Run asdf install php 8.3.1 or PHP_WITHOUT_PEAR=yes asdf install php 8.3.1.

Describe the Bug

Installation appears to error out when trying to install pear or composer because https is not enabled in php.ini during the installation.

When running asdf install php 8.3.1, I get the following errors:

Warning: fopen(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /private/var/folders/5_/jsnsc2s51wl08b_htp4xrctr0000gn/T/php-src-php-8.3.1/pear/fetch.php on line 66

Warning: fopen(https://pear.php.net/install-pear-nozlib.phar): Failed to open stream: No such file or directory in /private/var/folders/5_/jsnsc2s51wl08b_htp4xrctr0000gn/T/php-src-php-8.3.1/pear/fetch.php on line 66

Error..
fopen(https://pear.php.net/install-pear-nozlib.phar): Failed to open stream: No such file or directory
make: *** [install-pear] Error 1

When running PHP_WITHOUT_PEAR=yes asdf install php 8.3.1, I get the following errors:

Warning: copy(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in Command line code on line 1

Warning: copy(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in Command line code on line 1

Warning: copy(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in Command line code on line 1

Warning: copy(https://getcomposer.org/installer): Failed to open stream: No such file or directory in Command line code on line 1

Warning: hash_file(composer-setup.php): Failed to open stream: No such file or directory in Command line code on line 1
Installer corrupt
Warning: unlink(composer-setup.php): No such file or directory in Command line code on line 1

Could not open input file: composer-setup.php
tyler@My-MacBook-Pro installs %

Expected Behaviour

PHP successfully installs, or fails in a way that indicates a missing dependency before the installation fails on an https request.

tylerlwsmith avatar Dec 23 '23 23:12 tylerlwsmith

I've been able to work around this issue in two ways:

  1. Install OpenSSL on my MacBook using brew install [email protected]
  2. Update both instances of homebrew_package_path [email protected] to homebrew_package_path openssl in the install file.

tylerlwsmith avatar Dec 23 '23 23:12 tylerlwsmith

@tylerlwsmith Thank you for the workaround! I was pulling my hair out wondering why it wasn't working on my newer machine, but was fine on an older one.

It seems like [email protected] is an undocumented dependency on MacOS, it might be helpful if it were explicitly documented/installed in the Github actions workflow.

watsonarw avatar Jan 11 '24 01:01 watsonarw

I changed the install file to point to openssl without specifying version 1.1 and it worked.

yoonwaiyan avatar Jan 27 '24 00:01 yoonwaiyan

Continue @tylerlwsmith's awesome workaround but without editing files:

$ brew install [email protected]

### If you have openssl v3 installed (you most likely do)
$ brew unlink openssl@3
Unlinking /opt/homebrew/Cellar/openssl@3/3.2.1... 5867 symlinks removed.

$ brew link [email protected]
Linking /opt/homebrew/Cellar/[email protected]/1.1.1w... 3999 symlinks created.

If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"' >> ~/.zshrc

$ openssl version
OpenSSL 1.1.1w  11 Sep 2023

$ asdf install php xxx

### Restore openssl version to v3
$ brew unlink [email protected]
Unlinking /opt/homebrew/Cellar/[email protected]/1.1.1w... 3999 symlinks removed.

$ brew link openssl@3
Linking /opt/homebrew/Cellar/openssl@3/3.2.1... 5867 symlinks created.

$ openssl version
OpenSSL 3.2.1 30 Jan 2024 (Library: OpenSSL 3.2.1 30 Jan 2024)

tangrufus avatar Feb 09 '24 13:02 tangrufus

Oddly enough, after installing OpenSSL 1.1 via Homebrew and installing PHP 8.3, I did not need to switch to OpenSSL 1.1 to install other versions of PHP. I even tried to re-install PHP 8.3 with OpenSSL 3 linked and it worked properly. The build output shows that it actually uses [email protected]. Maybe we just need to have [email protected] installed?

tristanjahier avatar Feb 16 '24 12:02 tristanjahier

OpenSSL 1.1 reached end of life on September 11, 2023, and as such I get this warning when installing [email protected] from Homebrew:

Warning: [email protected] has been deprecated because it is not supported upstream!

Probably naive question: PHP 8.1 added support for OpenSSL 3.0 - can compile against that instead?

cameronmurphy avatar Feb 21 '24 23:02 cameronmurphy

for those on macOS who want openssl 3 with PHP:

godbout avatar Apr 17 '24 11:04 godbout

Oddly enough, after installing OpenSSL 1.1 via Homebrew and installing PHP 8.3, I did not need to switch to OpenSSL 1.1 to install other versions of PHP. I even tried to re-install PHP 8.3 with OpenSSL 3 linked and it worked properly. The build output shows that it actually uses [email protected]. Maybe we just need to have [email protected] installed?

You are correct. I just installed [email protected] and retried the installation and it worked, no need to switch versions or meddle with installation files

orthodoX avatar Aug 07 '24 16:08 orthodoX

For the benefit of future storm-tossed mariners driven onto the rocky shore, I had to add --with-openssl=$(brew --prefix openssl) to PHP_CONFIGURE_OPTIONS to make it work. I also had to add --with-iconv. Based on manually executing the lines in the install script that search for packages, both of those should have worked out of the box. So I'm not sure what's going on there.

jhclouse avatar Aug 12 '24 20:08 jhclouse