gpt4 book ai didi

php - PDO异常 : Can't open lib 'ODBC Driver 13 for SQL Server'

转载 作者:行者123 更新时间:2023-12-03 02:26:53 24 4
gpt4 key购买 nike

我尝试从 macOS 连接 MSSQL。我的 PHP/Laravel 应用程序在 macOS 中运行。

基于此link ,我运行了以下两个命令:

# sudo pecl install sqlsrv
# sudo pecl install pdo_sqlsrv

我收到消息说它已经安装了。

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

但是当我尝试连接mssql时,

#php artisan migrate:install

我得到以下异常:

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

我还需要安装什么?我的php版本是7.1

<小时/>

我尝试时遇到的问题

# 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.

所以改为:

# brew install  microsoft/msodbcsql/msodbcsql

然后我就明白了;

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>

最佳答案

您需要使用 --no-sandbox 安装 ODBC,如 brew install --no-sandbox msodbcsql

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

关于php - PDO异常 : Can't open lib 'ODBC Driver 13 for SQL Server' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45474305/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com