asdf-php
asdf-php copied to clipboard
MacOS: Unable to find the wrapper "https"
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.
I've been able to work around this issue in two ways:
- Install OpenSSL on my MacBook using
brew install [email protected]
- Update both instances of
homebrew_package_path [email protected]
tohomebrew_package_path openssl
in theinstall
file.
@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.
I changed the install
file to point to openssl
without specifying version 1.1 and it worked.
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)
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?
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?
for those on macOS who want openssl 3
with PHP:
- for PHP8.1+ edit the
install
file and replace[email protected]
byopenssl@3
- for PHP versions before 8.1, well, PHP only supports [email protected] so you don't need to edit the
install
file, but you need tobrew install [email protected]
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
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.