msphpsql
msphpsql copied to clipboard
osx 13.2 - M1 - OpenSSL library could not be loaded, make sure OpenSSL 1.0, 1.1, or 3.0 is installed
PHP version
php -v: PHP 8.2.3 (cli) (built: Feb 15 2023 00:18:01) (NTS)
which PHP: /opt/homebrew/bin/php
PHP SQLSRV or PDO_SQLSRV version
Pecl list:
Installed packages, channel pecl.php.net:
Package Version State imagick 3.7.0 stable pdo_sqlsrv 5.10.1 stable sqlsrv 5.10.1 stable
Microsoft ODBC Driver version
ODBC Driver for Microsoft(R) SQL Server(R)
https://msdn.microsoft.com/en-us/library/mt654048(v=sql.1).aspx
/opt/homebrew/Cellar/msodbcsql18/18.2.1.1 (10 files, 1.9MB) *
Built from source on 2023-03-02 at 13:04:24
SQL Server version
17
Problem description
I have installed PHP, and followed: https://github.com/microsoft/msphpsql/blob/master/Linux-mac-install.md#installing-the-drivers-on-macos for installing the tools and drivers.
IT sounds like I should be using openssl 1.1 so I have that installed: which openssl - /opt/homebrew/opt/[email protected]/bin/openssl openssl version - OpenSSL 1.1.1t 7 Feb 2023
I setup a simple connection PHP file to test this out based on notes from the docs and others:
` $serverName = "{IP ADDRESS},{PORT NUMBER}"; $connectionOptions = array( "Database" => "Wcb_301", "Uid" => "{USERNAME}", "PWD" => "{PASSWORD}" );
$conn = sqlsrv_connect($serverName, $connectionOptions);
if( $conn ) {
echo "Connection established.<br />";
}else{
echo "Connection could not be established.
";
die( print_r( sqlsrv_errors(), true));
}`
The result is:
`Connection could not be established.
Array
(
[0] => Array
(
[0] => 08001
[SQLSTATE] => 08001
[1] => -1
[code] => -1
[2] => [Microsoft][ODBC Driver 18 for SQL Server]SSL Provider: [OpenSSL library could not be loaded, make sure
OpenSSL 1.0, 1.1, or 3.0 is installed]
[message] => [Microsoft][ODBC Driver 18 for SQL Server]SSL Provider: [OpenSSL library could not be loaded,
make sure OpenSSL 1.0, 1.1, or 3.0 is installed]
)
[1] => Array
(
[0] => 08001
[SQLSTATE] => 08001
[1] => -1
[code] => -1
[2] => [Microsoft][ODBC Driver 18 for SQL Server]Client unable to establish connection
[message] => [Microsoft][ODBC Driver 18 for SQL Server]Client unable to establish connection
)
`
I even tracked through: https://github.com/microsoft/msphpsql/issues/1319 to see if that would help. No dice. Does anyone have any idea how to fix the problem or further debug it?
Could you try to run this script?
rm -f /usr/local/opt/openssl
ln -s /usr/local/opt/[email protected] /usr/local/opt/openssl
ls -ld /usr/local/opt/openssl*
@absci I am on an M1 so the paths are different. #1319 had similar recommendations but those did not solve it for me.
Is /opt/homebrew/opt/openssl/lib/ present? Because that's where the ARM64 driver looks for OpenSSL.
@v-chojas
If I run the command like shown above I get:
`tjsherrill@Tjs-MacBook-Pro ~ % ln -s /usr/local/opt/[email protected] /usr/local/opt/openssl
ln: /usr/local/opt/openssl: No such file or directory`
Does that make sense?
I'm asking about /opt/homebrew/opt/openssl/lib, not /usr/local/opt/openssl.
@v-chojas my apologies, I had miss-understood your comment. Yes the /opt/homebrew/opt/openssl/lib folder exists.
I attached a screenshot.
I have tried removing the symlink and putting it back, I also just tried adding /usr/local/opt folder and symlinking openssl there. No luck. Any other ideas?
Try isql -v -k '<your connection string goes here>'
from a command line. Does this give the same error?
Closing due to inactivity