Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PDOException: Can't open lib 'ODBC Driver 13 for SQL Server'

I try to connect MSSQL from macOS. My PHP/Laravel application runs in macOS.

Based on this link, I ran following two commands:

# sudo pecl install sqlsrv
# sudo pecl install pdo_sqlsrv

And i got message saying it is already installed.

pecl/pdo_sqlsrv is already installed and is the same as the released version 4.3.0
install failed.

But when I try to connect mssql,

#php artisan migrate:install

I get the following exception:

Illuminate\Database\QueryException]                                                                                                   
  SQLSTATE[01000]: [unixODBC][Driver Manager]Can't open lib 'ODBC Driver 13 for SQL Server' : file not found (SQL: create table "migrat  
  ions" ("id" int identity primary key not null, "migration" nvarchar(191) not null, "batch" int not null))                              



  [PDOException]                                                                                              
  SQLSTATE[01000]: [unixODBC][Driver Manager]Can't open lib 'ODBC Driver 13 for SQL Server' : file not found 

What else I need to install? My php version is 7.1


Issue I get when I try

# brew install msodbcsql 
Error: Formulae found in multiple taps: 
 * microsoft/msodbcsql/msodbcsql
 * microsoft/mssql-preview/msodbcsql

Please use the fully-qualified name e.g. `microsoft/msodbcsql/msodbcsql` to refer the formula.

So changed to:

# brew install  microsoft/msodbcsql/msodbcsql

Then I'm getting this;

Do you accept the license terms? (Enter YES or NO)
YES
==> odbcinst -u -d -n "ODBC Driver 13 for SQL Server"
==> odbcinst -i -d -f ./odbcinst.ini
Last 15 lines from /Users/ratha/Library/Logs/Homebrew/msodbcsql/02.odbcinst.ini:
2017-08-03 14:03:06 +1000

odbcinst -i -d -f ./odbcinst.ini

odbcinst: SQLInstallDriverEx failed with Invalid install path.

If reporting this issue please do so to (not Homebrew/brew or Homebrew/core):
microsoft/msodbcsql

/usr/local/Homebrew/Library/Homebrew/utils/github.rb:226:in `raise_api_error': curl failed!  (GitHub::Error)
curl: (22) The requested URL returned error: 422 Unprocessable Entity
curl: (3) <url> malformed
    from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:184:in `open'
    from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:233:in `issues_matching'
    from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:272:in `issues_for_formula'
    from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:369:in `fetch_issues'
    from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:365:in `issues'
    from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:419:in `dump'
    from /usr/local/Homebrew/Library/Homebrew/brew.rb:133:in `rescue in <main>'
    from /usr/local/Homebrew/Library/Homebrew/brew.rb:26:in `<main>
like image 861
Ratha Avatar asked Mar 09 '23 10:03

Ratha


1 Answers

You need to install ODBC with --no-sandbox as brew install --no-sandbox msodbcsql

https://github.com/Microsoft/homebrew-mssql-release/issues/1

like image 74
Genjutsu Avatar answered Mar 11 '23 01:03

Genjutsu