Composer uses wrong openssl version - macos

I have installed openssl#1.1 using brew and added the path to my bash-profile. From Terminal I run "which openssl" and it shows the correct location (as in my bash-profile). Also when I run "openssl version" is shows 1.1.0f so that is also correct.
But when I run "composer diagnose" I get the following warning:
The OpenSSL library (0.9.8y) used by PHP does not support TLSv1.2 or TLSv1.1.
If possible you should upgrade OpenSSL to version 1.0.1 or above.
I also ran "composer show --platform" and it shows:
lib-openssl 0.9.8.25 OpenSSL 0.9.8y 5 Feb 2013
What do I need to do to get Composer to use the correct version of OpenSSL?
I'm running:
OSX 10.12.6,
MAMP PHP 7.0.0,
Composer 1.5.2,
Brew 1.3.5
Any help would be appreciated.
UPDATE:
I tried adding symlinks as mentioned in many of the offered threads:
ln -s /usr/local/opt/openssl#1.1/lib/libcrypto.1.1.dyli /usr/local/lib/
ln -s /usr/local/opt/openssl#1.1/lib/libssl.1.1.dylib /usr/local/lib/
It didn't work. PHP still shows:
OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 0.9.8zh 14 Jan 2016
OpenSSL Header Version => OpenSSL 0.9.8y 5 Feb 2013
Openssl default config => /System/Library/OpenSSL/openssl.cnf
I first tried to symlink from /System/Library/OpenSSL but it wasn't permitted. Maybe I need to sudo it. Before I do that, are there any risks I should be aware of? Am I on the right path? It's very frustrating that some commands in Terminal point to the new openssl, while others don't.

This is exactly the issue I had.
I updated my OpenSSL per these instructions(the only way I found that worked on Mac OS High Sierra
Yet still, Composer showed an error
Then, I followed the instructions in this Video
Problem solved (finally, after 3 days of dead ends)

Check PHP version your Mac OS shipping. It should like PHP 5.6.
Try to upgrade your version of PHP to 7.0 or above.
And run command again check version on your current folder.
php -v
php -i | grep OpenSSL
If the output of php -v still doesn’t echoes the version 7, type following command to update your path.
export PATH=/usr/local/php5/bin:$PATH

Related

make fails to build squid with openssl (deprecated functions used)

I'm trying to build squid with openssl, but fail because make threats warnings as errors
An example: gadgets.h -> error 'void RSA_free(RSA*)' is deprecated; Since **Openssl 3.0.0** -Werror=deprecated-declarations ..
I assume that -Werror=deprecated-declarations instructs make to threat these warnings as errors. But in which file is -Werror=deprecated-declarations? How can I suppress this / avoid it?
I need squid with openssl.
france1 answers correct. But maybe "step by step" commands will help to someone. I successfully built Squid 5.5 on Ubuntu 22.04 with Openssl 3.0.2.
Download openssl 1.1.1j:
cd /tmp/
wget https://github.com/openssl/openssl/archive/refs/tags/OpenSSL_1_1_1j.zip
Extract and install openssl to /usr/local/openssl_1_1_1j from source
unzip openssl-OpenSSL_1_1_1j.zip
cd ./openssl-OpenSSL_1_1_1j/
./config --prefix=/usr/local/openssl_1_1_1j --openssldir=/usr/local/openssl_1_1_1j/ssl
make
sudo make install
Export vars
export PATH="/usr/local/openssl_1_1_1j/bin:$PATH" LD_LIBRARY_PATH="/usr/local/openssl_1_1_1j/lib:$LD_LIBRARY_PATH"
export PKG_CONFIG_PATH=/usr/local/openssl_1_1_1j/lib/pkgconfig
Download squid and compile with custom openssl:
wget http://www.squid-cache.org/Versions/v5/squid-5.5.tar.gz
tar -xzvf ./squid-5.5.tar.gz
cd squid-5.5/
./configure --enable-ssl-crtd --with-openssl=/usr/local/openssl_1_1_1j/lib
make
sudo make install
Works!
I can compile the latest version by openssl 3. It should be fixed
check https://github.com/squid-cache/squid/commit/3db8afad158dcdaa9390d8b998239e5763ae2cf4
# squid -v
Squid Cache: Version 5.7-VCS
Service Name: squid
This binary uses OpenSSL 3.0.2 15 Mar 2022.
Ha Ha!
These things are deprecated since Openssl 3.0.0.
I just used Openssl 1.1.1 LTS - and it worked!
But later on I noticed that there's a squid-openssl in the ubuntu 20.10 repository.. so I installed that.
Openssl 1.1.1l: https://www.openssl.org/source/openssl-1.1.1l.tar.gz

How do I build the Firebird database extension (ext-interbase) for PHP on a MacOS M1 Monterey?

Firebird Extension for PHP on MacOS M1
I have PHP7.4 installed with homebrew and the Xcode command line tools.
I followed the instructions as per the source repository here https://github.com/FirebirdSQL/php-firebird using the following methodology, I have changed the Linux formula to suite the MacOS library locations as per this answer here
Issues compiling firebird driver for PHP-7.4 on macos:
git clone https://github.com/FirebirdSQL/php-firebird.git
cd php-firebird
phpize
CPPFLAGS=-I/Library/Frameworks/Firebird.framework/Headers LDFLAGS=-L/Library/Frameworks/Firebird.framework/Resources/lib ./configure
make
The error I get is
configure: error: libfbclient, libgds or libib_util not found! Check config.log for more information.
In the log file it refers to the following which is the crux of the issue
ld: warning: ignoring file /opt/firebird/lib/libib_util.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
The problem is that the Firebird package for Mac is only built for the 64bit architecture and not the ARM architecture.
Solution
I always seem to struggle building the extension for Firebird on MacOS (Intel or M1) and after a month of leaving the problem I discovered the solution which I leave here for myself all of you who have hit this wall, until ARM is supported on MacOS for Firebird we probably have to run the 64 bit version with 64 bit PHP. The steps below should get you up and running. I came up with 2 solutions, the first most obvious one was to make a docker build.
Docker Solution
docker run -v $(pwd):/app tina4stack/php -ini | grep interbase
Home brew solution
The second solution (more complicated) was to follow these steps, I don't always like to run a docker engine for simple things.
Install latest Firebird for MacOS
First, make sure you have installed the latest Firebird MacOS package, Firebird 3.0 at the time of writing has only one you can install.
The next problem I ran into was home-brew had installed an ARM version of PHP which made the linking to the x86_64 architecture impossible. Kudos to the documentation here https://austencam.com/posts/setting-up-an-m1-mac-for-laravel-development-with-homebrew-php-mysql-valet-and-redis
Install Rosetta
First I installed Rosetta (helps run 64 bit apps on MacOS ARM)
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
Install Home-brew for 64bit architecture
Next I removed homebrew and reinstalled it with the arch -x86_64 bit flag
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Install PHP7.4
Then installed a fresh php#7.4
arch -x86_64 brew install php#7.4
Compile the extension
git clone https://github.com/FirebirdSQL/php-firebird.git
cd php-firebird
phpize
CFLAGS='-arch x86_64' CPPFLAGS=-I/Library/Frameworks/Firebird.framework/Headers LDFLAGS=-L/Library/Frameworks/Firebird.framework/Resources/lib ./configure
make
sudo make install
Tying it all together
I added the following to my php.ini file
extension=interbase
If you don't know where to edit your ini file, run the following command:
php -ini | grep php.ini
When I ran php -ini | grep interpose I got errors about not finding the firebird libraries. In the end I copied the libraries to the PHP bin and lib folders
cp /Library/Frameworks/Firebird.framework/Resources/lib/* /usr/local/Cellar/php#7.4/7.4.25/lib
cp /Library/Frameworks/Firebird.framework/Resources/lib/* /usr/local/Cellar/php#7.4/7.4.25/bin
I'm sure someone could comment on making the above a bit neater but I was happy to find that the ini command returns now as expected.
php -ini | grep interbase
interbase
Let me know if you hit issues I didn't find, there were some other things I tried for the Firebird library resolution but I'm not sure they worked.
Installing modules with PECL
As an addition the the above solution, easily install other PHP modules using the following command
arch -x86_64 pecl install <module>
Example
arch -x86_64 pecl install openswoole

PHP OpenSSL is missing during composer installation on Windows

I have a LAMP server Denwer installed on Windows 7. When I try to install composer, it stops with "The openssl extension is missing... If possible you should enable it or recompile php with --with-openssl" message.
Despite that I OpenSSL extension already enabled, I checked that by running this command:
> php -i | find "OpenSSL"
OpenSSL support => enabled
Any ideas?

Can't run Composer on my Mac Mountain Lion - openssl extension

I installed several CMS that require Composer.
Since 2 days i got error and can't go on.
[RuntimeException] You must enable the openssl extension to download files via https
I check the following:
$ openssl version OpenSSL 1.0.1e 11 Feb 2013
$ which openssl /opt/local/bin/openssl
phpinfo say Phar - Native OpenSSL support enabled and OpenSSL support enabled.
Still if i do
$ php -info| grep openssl OpenSSL support => disabled (install ext/openssl)
Does someone has a clue about what i should do to be able to run Composer ?
In doubt (tks to Sven for pushing me that direction ;) ), I reinstall using port the openssl extension.
sudo port install php5-openssl
It didn't download files but reset something in the preferences and i was able to run Composer install properly on Tiki Wiki CMS (the CMS i'm using most).
which version you install is also important. there is a bug in openssl 0.9.8.
read more here: https://github.com/composer/composer/issues/2021

Updating OpenSSL version on OSX

Currently on OSX 10.7 Lion openssl 0.9.8r is installed. This build is from Feb 2011 and I want to update it to the newest version. I can't use the autoupdate because I need the enable-cms option so I built it from the source, run ./Configure darwin64-x86_64-ccand ./config enable-cms --openssldir=~/usr/local/ssl.
Then I made "make" and "make install" without any errors but there is still the old version installed.
> openssl version
OpenSSL 0.9.8r 8 Feb 2011
What am I doing wrong? Maybe it's the folder? I only guessed that the ssl folder in /usr/local/ must be the default open ssl installation directory from Mac OSX?
Okay, I found a solution.
Before starting:
download sources
unpack sources
go into the unpacked source directory
The prefix has to be set on the /usr/ folder.
sudo ./configure --prefix=/usr/ darwin64-x86_64-cc enable-cms
sudo make
sudo make install
Note: To perform just a normal update you can drop the enable-cms option.
brew version (installed in '/usr/local/opt/openssl/bin') has such support for me.
https://formulae.brew.sh/formula/openssl#1.1

Resources