Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS 11.6 - M1 - "OpenSSL library could not be loaded, make sure OpenSSL 1.0 or 1.1 is installed" #1319

Closed
LinkingYou opened this issue Oct 25, 2021 · 7 comments

Comments

@LinkingYou
Copy link

PHP Driver version or file name

pecl list
Installed packages, channel pecl.php.net:
=========================================
Package    Version     State
pdo_sqlsrv 5.10.0beta1 beta
sqlsrv     5.10.0beta1 beta

SQL Server version

Microsoft SQL Server 2012

Client operating system

macOS Big Sur 11.6 on a MacBook Air (M1, 2020)

PHP version

php -v
PHP 8.0.12 (cli) (built: Oct 21 2021 06:07:28) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.12, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.12, Copyright (c), by Zend Technologies

Microsoft ODBC Driver version

brew info msodbcsql17
microsoft/mssql-release/msodbcsql17: stable 17.8.1.1
ODBC Driver for Microsoft(R) SQL Server(R)

Problem description

I have installed PHP, the microsoft odbc driver and sqlsrv / pdo_sqlsrv following this tutorial https://github.com/microsoft/msphpsql/blob/master/Linux-mac-install.md#installing-the-drivers-on-macos on my new Mac.

The pecl-install-commands I have changed to the latest beta version:

sudo CXXFLAGS="-I/opt/homebrew/opt/unixodbc/include/" LDFLAGS="-L/opt/homebrew/lib/" pecl install sqlsrv-5.10.0beta1
sudo CXXFLAGS="-I/opt/homebrew/opt/unixodbc/include/" LDFLAGS="-L/opt/homebrew/lib/" pecl install pdo_sqlsrv-5.10.0beta1

At first everything looked fine. But if i want to connect to the database server, i always get this errors:

Uncaught Exception: SQLSTATE[08001]: [Microsoft][ODBC Driver 17 for SQL Server]SSL Provider: [OpenSSL library could not be loaded, make sure OpenSSL 1.0 or 1.1 is installed]

I also tested using the test scripts in the manual above with the same error messages.

Here are some more informations about my openssl installation:

openssl version 
OpenSSL 1.1.1l  24 Aug 2021
which openssl
/opt/homebrew/opt/openssl@1.1/bin/openssl
echo $PATH
/opt/homebrew/opt/openssl@1.1/bin:/opt/homebrew/opt/openssl@1.1/lib:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin

Does anyone have any idea how to fix the problem or further debug it?

@yitam
Copy link
Contributor

yitam commented Oct 25, 2021

Yes @LinkingYou it's a known issue and ODBC team is looking into this. Meanwhile, please check this issue for workarounds.

@LinkingYou
Copy link
Author

Hi @yitam , thank you for your prompt reply.

The variant suggested in this article is unfortunately not successful for me.

This is probably also due to the fact that the paths are completely different for a new Brew installation on an M1 Mac under Big Sur.

Openssl 1.1 is located here:

cd /opt/homebrew/Cellar/openssl@1.1/1.1.1l_1
ls -al
total 1304
drwxr-xr-x  14 franky  admin     448 21 Okt 17:34 .
drwxr-xr-x   3 franky  admin      96 21 Okt 17:34 ..
drwxr-xr-x   3 franky  admin      96 24 Aug 15:38 .bottle
drwxr-xr-x   3 franky  admin      96 24 Aug 15:38 .brew
-rw-r--r--   1 franky  admin     854 24 Aug 15:38 AUTHORS
-rw-r--r--   1 franky  admin  599288 24 Aug 15:38 CHANGES
-rw-r--r--   1 franky  admin    1157 21 Okt 17:34 INSTALL_RECEIPT.json
-rw-r--r--   1 franky  admin    6121 24 Aug 15:38 LICENSE
-rw-r--r--   1 franky  admin   44387 24 Aug 15:38 NEWS
-rw-r--r--   1 franky  admin    3158 24 Aug 15:38 README
drwxr-xr-x   4 franky  admin     128 21 Okt 17:34 bin
drwxr-xr-x   3 franky  admin      96 24 Aug 15:38 include
drwxr-xr-x  10 franky  admin     320 21 Okt 17:34 lib
drwxr-xr-x   4 franky  admin     128 24 Aug 15:38 share

The /usr/local folder looks like this:

cd /usr/local 
ls -al
total 0
drwxr-xr-x   4 root  wheel  128 14 Okt 08:53 .
drwxr-xr-x@ 11 root  wheel  352  1 Jan  2020 ..
drwxr-xr-x  21 root  wheel  672 25 Okt 22:16 bin
drwxr-xr-x   3 root  wheel   96 14 Okt 08:53 lib

I have already tried to remove the homebrew paths from the Path variable and to symlink the Openssl 1.1 binary to /usr/local/bin. "which openssl" then pointed to this binary and with "openssl version" the 1.1.1l was also confirmed. But the error remains as described.

@yitam
Copy link
Contributor

yitam commented Oct 25, 2021

Hi @LinkingYou, is your Homebrew in emulator mode?

@LinkingYou
Copy link
Author

Hi @yitam ,

no - here are my "brew config" output - "rosetta" is not in use:

brew config
HOMEBREW_VERSION: 3.3.0
ORIGIN: https://github.com/Homebrew/brew
HEAD: 2be6ab6dab76ff0becf7de3c0336ae5196816c57
Last commit: 10 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 81b4458c7f0c11313accf21f681e49e15110bb41
Core tap last commit: 16 minutes ago
Core tap branch: master
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_CORE_GIT_REMOTE: https://github.com/Homebrew/homebrew-core
HOMEBREW_MAKE_JOBS: 8
Homebrew Ruby: 2.6.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: octa-core 64-bit arm_firestorm_icestorm
Clang: 13.0.0 build 1300
Git: 2.30.1 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: 7.64.1 => /usr/bin/curl
macOS: 11.6.1-arm64
CLT: 13.0.0.0.1.1630607135
Xcode: 13.0
Rosetta 2: false

On the Homebrew site https://docs.brew.sh/Installation is the installation path for "Apple Silicon" described with "/opt/homebrew".

It's a brand new Mac - not an upgrade from a previous version of macOS.

@yitam
Copy link
Contributor

yitam commented Oct 25, 2021

Thanks for your confirmation, @LinkingYou

In Apple M1, make sure there's no OpenSSL@3 and then try the following steps:

ln -s /opt/homebrew/Cellar/openssl@1.1/1.1.1l_1 /opt/homebrew/opt/openssl

If this already exists please rm /opt/homebrew/opt/openssl first

Then try ls /opt/homebrew/opt/openssl and see if it indeed points to the right directory

@LinkingYou
Copy link
Author

Hi @yitam ,

great!! Openssl@3 is already present, because it's "required by msodbcsql17 and mssql-tools, which are currently installed".

But your symlink works for me:

rm /opt/homebrew/opt/openssl
ln -s /opt/homebrew/Cellar/openssl@1.1/1.1.1l_1 /opt/homebrew/opt/openssl

Many thanks for your support!!!! I hereby close the ticket - the workaround is sufficient for me for now.

@yitam
Copy link
Contributor

yitam commented Oct 25, 2021

You're very welcome, @LinkingYou. Glad to be of help!
Please check the updates of the aforementioned issue because ODBC team is looking into this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants