Use Homebrew OpenSSL instead of MAMP one - macos

I'm trying to use composer to install packages but I get this message :
The "https://packages.drupal.org/8/packages.json" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version
Failed to enable crypto
failed to open stream: operation failed
I upgraded my homebrew openssl to the last version but composer seems to use an old installation in MAMP library:
$ which openssl
/Applications/MAMP/Library/bin/openssl
$ openssl version -d
OPENSSLDIR: "/Applications/MAMP/Library/OpenSSL"
$ whereis openssl
/usr/bin/openssl
$ openssl version
OpenSSL 1.0.2j 26 Sep 2016
anyway I get this when I try to reinstall composer:
$ curl -sS https://getcomposer.org/installer | php
Downloading...
Composer (version 1.5.2) successfully installed to: /Volumes/YOM_2/htdocs/composer.phar
Use it: php composer.phar
Some settings on your machine may cause stability issues with Composer.
If you encounter issues, try to change the following:
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.
How can I make it use the last version? I'm lost...
Thank you.

Related

OpenSSL 1.0.2m on macOS

For building one particular library I need openssl library version 1.0.2m with devel package. I am working on macOS. Using brew install openssl installs latest version 1.1.1d.
Since OpenSSL 1.0.2 is end of lifed by the end of 2019, it is no longer available via Homebrew. This is mentioned in the Homebrew 2.2.0 announcement.
It is fairly straightforward to build and install OpenSSL 1.0.2 yourself from source. You can download your required version from the Old 1.0.2 Releases page and follow the instructions found in INSTALL.
It may be possible as well to recover an older formula and install from that, but I can not guarantee how well that works. The following steps did complete the installation process:
$ git clone https://github.com/Homebrew/homebrew-core.git
$ cd homebrew-core
$ git checkout 75b57384 Formula/openssl.rb
$ brew install Formula/openssl.rb
For me, this showed:
Warning: openssl 1.1.1d is available and more recent than version 1.0.2m.
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2m.high_sierra.bottle.tar.gz
and went on happily after that. A quick try at the end gives some confidence that it worked out well:
$ /usr/local/opt/openssl/bin/openssl version
OpenSSL 1.0.2m 2 Nov 2017
If you prefer not to use git directly, you can also try downloading that version of openssl.rb from gitHub.com and run brew install on it.
If you wonder where that commit hash came from, I happened to know that the formula used to be called -- surprise -- openssl.rb (but using git to query for removed files would have worked as well). Therefore, I inspected the history for Formula/openssl.rb and found:
$ git log -- Formula/openssl.rb
...
commit 75b573845a17aaf3f7c84dc58e97cf5fe39a502b
Author: BrewTestBot <brew-test-bot#googlegroups.com>
Date: Thu Nov 2 17:20:33 2017 +0000
openssl: update 1.0.2m bottle.
Recently I was struggling due to the recent update in openssl version from 1.0 to 1.1 and wanted to revert it back to older version. No other solution except the one given below worked for me:
brew install rbenv/tap/openssl#1.0
rvm reinstall 1.9.3-p551 --with-openssl-dir='/usr/local/opt/openssl#1.0'
gem update --system
Instead of downloading the specific version of Formula/openssl.rb you can just use the raw reference to the file with the specific commit SHA as mentioned here.
So for the last update to version 1.0.2t the SHA is 8b9d6d688f483a0f33fcfc93d433de501b9c3513
commit 8b9d6d688f483a0f33fcfc93d433de501b9c3513
Author: BrewTestBot <homebrew-test-bot#lists.sfconservancy.org>
Date: Sat Sep 28 19:38:49 2019 +0000
openssl: update 1.0.2t bottle.
So I would execute the following command to install 1.0.2t.
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/8b9d6d688f483a0f33fcfc93d433de501b9c3513/Formula/openssl.rb
1- Download the file:
wget https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb
2 - Run brew with the file downloaded:
brew install openssl.rb
Other solutions won't work because you will get this error "Calling Installation of openssl from a GitHub commit URL is disabled! Use 'brew extract openssl' to stable tap on GitHub instead." the following steps will fix it:
First go to the local installation of homebrew
cd /usr/local/Homebrew/
Homebrew 2.5 remove the option to install formulas directly from git repos so we need to checkout an older version
git checkout 2.3.0
Install openssl latest 1.0.x version
HOMEBREW_NO_AUTO_UPDATE=1 brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb
Go back to current version of homebrew
git co -
Tell brew to use the old version of openssl this way you can chose wich version to use if you have both intalled
brew switch openssl 1.0.2t
Update - I think I've been getting downvotes because I've simply posted a link without the solution. So here's the solution:
Download this formula for OpenSSL V1.0 (It is patched to work with the arm64 processor)
Install it brew install openssl#1.0.rb
Add this version to the beginning of your PATH.
Note: Make sure that RVM is the last PATH variable change in your shell config file (.zshrc / .bashrc)
echo 'export PATH="/opt/homebrew/opt/openssl#1.0/bin:$PATH"' >> ~/.zshrc
Export some required environment variables
export LDFLAGS="-L/opt/homebrew/opt/openssl#1.0/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl#1.0/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl#1.0/lib/pkgconfig"
Reload your shell config source ~/.zshrc
Verify your openssl version
> openssl version
OpenSSL 1.0.2u 20 Dec 2019
Disable RVM autolibs rvm autolibs disable
Export some env variables to avoid compilation errors
export RUBY_CFLAGS=-DUSE_FFI_CLOSURE_ALLOC
export optflags="-Wno-error=implicit-function-declaration"
Install Ruby
rvm install 2.3.0 --with-openssl-dir=/opt/homebrew/opt/openssl#1.0
Ref
Maybe it's not a perfect idea, but it solved my problem (libssl.1.0.0.dylib image not found):
sudo ln -s /usr/lib/libssl.dylib /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
sudo ln -s /usr/lib/libcrypto.dylib /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib
Hope it works for you!
See this reply
Here is the linux-brew formula for openssl#1.0.2
brew install https://raw.githubusercontent.com/Homebrew/linuxbrew-core/20ab55b304597c6c47149dc0e50bd5f7ea45b678/Formula/openssl.rb

mac os x openssl update error

I need your help :)
I have mac os x 10.11.2,
And I have updated openssl library:
brew update
brew install openssl
brew link --force openssl.
After command "openssl version" I saw: OpenSSL 1.0.2h 3 May 2016
But after command "php -i | grep -i ssl" I saw:
OpenSSL Library Version => OpenSSL 0.9.8zg 14 July 2015
OpenSSL Header Version => OpenSSL 0.9.8zc 19 Mar 2015
And I can't install composer, get error: The OpenSSL library (0.9.8zc) used by PHP does not support TLSv1.2 or TLSv1.1.
How can I resolve it? It really strange...
PHP and OpenSSL are also present in the Mac OS X system.
The fact that you have installed a second version via Homebrew does not mean it will automaically be used. you will need to make sure that composer finds the version provided by Homebrew (installed in /usr/local/).

Warning: openssl-1.0.2g already installed when using HomeBrew

I'm working on OS X 10.11.4. I'm trying to get started with Zend Framework2 and am using the official manual so have installed composer. When installing composer I got this warning:
The OpenSSL library (0.9.8zc) used by PHP does not support TLSv1.2 or
TLSv1.1. If possible you should upgrade OpenSSL to version 1.0.1 or
above.
So I opened Terminal and used the following to check my openssl version:
$ openssl version
OpenSSL 0.9.8zh 14 Jan 2016
So I looked into updating and came across How to upgrade OpenSSL in OS X on the Apple Stack Exchange. I then used the following to update HomeBrew and install the latest version of OpenSSL
$ brew update
$ brew install openssl
But got this warning:
Warning: openssl-1.0.2g already installed
So then I followed this advice (Update OpenSSL on OS X with Homebrew - top answer)
$ brew unlink openssl && brew link openssl --force
Unlinking /usr/local/Cellar/openssl/1.0.2g... 1591 symlinks removed
Linking /usr/local/Cellar/openssl/1.0.2g... 1588 symlinks created
$ which openssl
/usr/local/bin/openssl
$ openssl version
OpenSSL 0.9.8zh 14 Jan 2016
So it seems I have the updated version on my machine but it isn't being used by default?
Sorry for my naivety but I'm a complete beginner.
Can any one tell me what I'm doing wrong?
Thanks in advance

Mcrypt PHP extension required on Mac OS X

I keep getting this error
Mcrypt PHP extension required
at the bottom after I run a composer update :
Since I am using Mac, I have tried running :
brew search mcrypt
brew install php56-mcrypt
I still get the same error message.
Steps
I solved this by running the following commands
brew update
brew upgrade
brew tap homebrew/dupes
brew tap josegonzalez/homebrew-php
brew install php54-mcrypt
php --version // To Test your php
sudo composer update
Result
No more Mcrypt warning !!
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
Generating optimized class loader
After update brew:
brew update
brew upgrade
brew tap homebrew/dupes
brew tap josegonzalez/homebrew-php
If you have installed php5.6 (or higher), you can use the following command to find out what versions are available in brew:
$ brew search mcrypt
homebrew/php/php53-mcrypt homebrew/php/php55-mcrypt homebrew/php/php70-mcrypt mcrypt
homebrew/php/php54-mcrypt homebrew/php/php56-mcrypt homebrew/php/php71-mcrypt
In my case, I am using php7.0:
$ brew install php70-mcrypt
On macOS High Sierra I did this steps:
1- Search the package:
brew search mcrypt
Result:
==> Searching local taps... homebrew/php/php71-mcrypt mcrypt homebrew/php/php53-mcrypt
homebrew/php/php54-mcrypt homebrew/php/php55-mcrypt
homebrew/php/php56-mcrypt homebrew/php/php70-mcrypt
libtomcrypt
2- Search my php version to know what can I need to install:
php --version
Result:
PHP 7.1.7 (cli) (built: Jul 15 2017 18:08:09) ( NTS ) Copyright (c)
1997-2017 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2017
Zend Technologies
3- Install the correct package, for me was 7.1.7 => homebrew/php/php71-mcrypt
brew install homebrew/php/php71-mcrypt
4- Find the find "mcrypt.so" extension file
find /usr/ -type f -name "mcrypt.so"
Result:
find:
/usr//local/Cellar/php71-mcrypt/7.1.13_19/mcrypt.so
5- Search the php.ini
php -i | grep 'Configuration File'
Result (if exist):
Configuration File (php.ini) Path => /etc Loaded Configuration File =>
/etc/php.ini
6- Add the next line at the end on /etc/php.ini (see the last step your correct path) the extension mcrypt.so
extension=/usr/local/Cellar/php71-mcrypt/7.1.13_19/mcrypt.so
Finish, you can now execute your command.
You'll need to add the line
extension=mcrypt.so
In your phi.ini file responsible for the CLI PHP version.
To find where it is, run:
php -i | grep 'Configuration File'
In use XAMPP on my Mac, so I had to install php and then compile mcrypt using pecl, after that I copied mcrypt.so to XAMPP.
The actual list of available releases is: http://pecl.php.net/package/mcrypt
The commands was:
echo Install php...
brew install php
/usr/local/opt/php/bin/php -v
echo Correction of "error Connection to `ssl://pecl.php.net:443' failed"...
wget http://curl.haxx.se/ca/cacert.pem
sudo cp cacert.pem /private/etc/ssl/cert.pem
sudo mv cacert.pem /Applications/XAMPP/xamppfiles/share/openssl/cert.pem
/usr/local/opt/php/bin/pecl list-all
echo Compile and Install mcrypt.so...
sudo /usr/local/opt/php/bin/pecl install mcrypt-1.0.1
The last message of build process of pecl was:
Build process completed successfully
Installing '/usr/local/Cellar/php/7.2.7/pecl/20170718/mcrypt.so'
install ok: channel://pecl.php.net/mcrypt-1.0.1
Extension mcrypt enabled in php.ini
Based on path of build process I copied the compiled mcrypt.so to XAMPP and enable the extension on php.ini:
sudo cp /usr/local/Cellar/php/7.2.7/pecl/20170718/mcrypt.so /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20170718/mcrypt.so
echo 'extension=mcrypt.so' >> /Applications/XAMPP/xamppfiles/etc/php.ini
Check if it works:
/Applications/XAMPP/bin/php -i | grep "mcrypt"
The result have to be:
mcrypt
mcrypt support => enabled
mcrypt_filter support => enabled
mcrypt.algorithms_dir => no value => no value
mcrypt.modes_dir => no value => no value
Remember to restart Apache to see it working using browser.
Maybe it helps someone and I win one thumbs up. Thanks
if you using brew try this :
1.Unistall existing php then Install shivammathur/php
add shivammathur php
brew tap shivammathur/php
change php version with you needed (5.6 or 7.2 or 7.4 or 8.1 or next version)
brew install shivammathur/php/php#8.1
2.Install shivammathur/extensions it s will add extension to php
then
brew tap shivammathur/extensions
brew install shivammathur/extensions/mcrypt#8.1
then you install mcrypt with same version as php version
brew install mcrypt#8.1
then restart httpd
brew services restart httpd
Ref :
https://github.com/shivammathur/homebrew-php
https://github.com/shivammathur/homebrew-extensions

Can't install OpenSSL 1.0.1e

I've tried to install a new version of OpenSSL via Homebrew but it doesn't work. My actual OpenSSL version is 0.9.8 and I don't know what to do.
When I type on MacOS 10.8.4 brew install openssl the system brings to me the following error:
Error: openssl-1.0.1e already installed
So when I type openssl version I see this:
OpenSSL 0.9.8x 10 May 2012
How can I turn the actual version to the new version installed via Homebrew? Any tips?
My guess is that OS X has an older version of openssl in /usr/bin, and Homebrew places it's version in /usr/local/bin
Try
/usr/local/bin/openssl version
Edit: Before you try the above command, run:
brew link --force openssl

Resources