【发布时间】:2018-01-10 11:22:43
【问题描述】:
我尝试从 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>
【问题讨论】:
-
在微软 GIt github.com/Microsoft/msphpsql/issues/489987654322@报告的问题
标签: php sql-server macos laravel