Php PDO例外:Can';t打开lib';用于SQL Server的ODBC驱动程序13';
我尝试从macOS连接MSSQL。我的PHP/Laravel应用程序在macOS中运行Php PDO例外:Can';t打开lib';用于SQL Server的ODBC驱动程序13';,php,sql-server,macos,laravel,Php,Sql Server,Macos,Laravel,我尝试从macOS连接MSSQL。我的PHP/Laravel应用程序在macOS中运行 Illuminate\Database\QueryException] SQLSTATE[01000]: [unixODBC][Driver Manager]Can't open lib 'ODBC Drive
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
基于此,我运行了以下两个命令:
# sudo pecl install sqlsrv
# sudo pecl install pdo_sqlsrv
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
我收到消息说它已经安装好了
pecl/pdo_sqlsrv is already installed and is the same as the released version 4.3.0
install failed.
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
但是当我尝试连接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
我得到以下例外情况:
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
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
我尝试时遇到的问题
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
# 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.
因此改为:
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
# brew install microsoft/msodbcsql/msodbcsql
然后我得到这个
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
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>
您接受许可条款吗?(输入是或否)
对
==>odbcinst-u-d-n“SQL Server的ODBC驱动程序13”
==>odbcinst-i-d-f./odbcinst.ini
来自/Users/ratha/Library/Logs/Homebrew/msodbcsql/02.odbcinst.ini的最后15行:
2017-08-03 14:03:06 +1000
odbcinst-i-d-f./odbcinst.ini
odbcinst:SQLInstallDriverEx失败,安装路径无效。
如果报告此问题,请向(非自制/自制或自制/核心)报告:
microsoft/msodbcsql
/usr/local/Homebrew/Library/Homebrew/utils/github.rb:226:in'raise\u api\u error':curl失败!(GitHub::错误)
curl:(22)请求的URL返回错误:422无法处理的实体
卷曲:(3)畸形
from/usr/local/Homebrew/Library/Homebrew/utils/github.rb:184:in'open'
from/usr/local/Homebrew/Library/Homebrew/utils/github.rb:233:in“issues\u matching”
from/usr/local/Homebrew/Library/Homebrew/utils/github.rb:272:in“公式的问题”
from/usr/local/Homebrew/Library/Homebrew/exceptions.rb:369:in'fetch_issues'
from/usr/local/Homebrew/Library/Homebrew/exceptions.rb:365:in `问题'
from/usr/local/Homebrew/Library/Homebrew/exceptions.rb:419:in'dump'
from/usr/local/Homebrew/Library/Homebrew/brew.rb:133:in'rescue in'
from/usr/local/Homebrew/Library/Homebrew/brew.rb:26:in`
我相信“Microsoft ODBC驱动程序13”的先决条件尚未安装在Mac上
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
根据这篇文章,微软似乎正在开发Mac版本的驱动程序
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
因为你和拉威尔一起工作;第一次尝试
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
composer update && upgrade
从web应用程序的根目录查看是否可以自动提取所有依赖项
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
如果没有,请尝试按照上面提供的链接中的说明安装驱动程序
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
如果您已经安装了ODBC驱动程序,它应该位于Mac上的以下目录中
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
/Library/ODBC/
干杯。您需要安装ODBC时使用
--无沙箱
作为brew安装--无沙箱msodbcsql
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
重新安装软件包:
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
brew tap microsoft/msodbcsql https://github.com/Microsoft/homebrew-mssql-release
ACCEPT_EULA=y brew reinstall --no-sandbox msodbcsql mssql-tools
如果仍在发生,请运行:
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
cp -v "$(brew list msodbcsql | grep odbcinst.ini$)" ~/.odbcinst.ini
复制定义SQL ODBC驱动程序位置的INI文件
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
或手动创建文件,例如
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
printf "[ODBC Driver 13 for SQL Server]\nDescription=Microsoft ODBC Driver 13 for SQL Server\nDriver=/usr/local/lib/libmsodbcsql.13.dylib\n" >> ~/.odbcinst.ini
错误报告:
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
请参阅:
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
如果您正在使用Anaconda,请检查此问题:。谢谢。我跟随上面的博文,在这一行我得到了问题;brew安装msodbcsql。我已将我的问题与您可能需要的问题进行了编辑。它过去与OSX一起提供,但较新的操作系统没有。安装并重试?我安装了。但同样的问题:(@Genjutsu answer应该会带你走完剩下的路。祝你好运。在Microsoft GIt brew安装中报告的问题——没有沙盒msodbcsql解决了我面临的实际问题这也解决了我遇到的问题
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