简体   繁体   English

无法在Mac上获得DBLIB PDO设置以连接到MS SQL

[英]Can't get DBLIB PDO setup on mac to connect to MS SQL

I am trying to connect to an external mssql database from my local dev environment on Mac El Capitan. 我正在尝试从Mac El Capitan上的本地开发环境连接到外部mssql数据库。 I notice in my php info that I do not have dblib setup in my pdo. 我在我的PHP信息中注意到,我的pdo中没有dblib设置。 I have mysql, odbc, sqlite. 我有mysql,odbc,sqlite。 I have been looking all around to see how to get this installed and pretty much everything I have seen says to use Freetds to accomplish this. 我一直在四处寻找如何安装此工具,以及我见过的几乎所有有关使用Freetds来完成此操作的内容。 I did a brew install Freetds and it says "freetds-0.95.69 already installed". 我做了一个brew安装Freetds,并说“ freetds-0.95.69已经安装”。 So that tells me I already have it. 所以这告诉我我已经拥有了。 I am wondering if there are more steps that I am missing such as putting something in my php.ini file to get this working. 我想知道是否还缺少其他步骤,例如将某些内容放入php.ini文件中以使其正常工作。

I also saw another suggestion to turn on mssql_secure_connection = On in my php.ini which I did but that did not help. 我也看到了另一个建议,在我的php.ini中打开mssql_secure_connection = On,但这没有帮助。

Any additional suggestions would be appreciated. 任何其他建议,将不胜感激。

I am using a connection like this and it works when I upload it to my server which has the appropriate drivers installed. 我正在使用这样的连接,当我将其上传到安装了适当驱动程序的服务器时,它可以工作。

$DBH = new PDO( "dblib:host=$host;dbname=$dbname", $user, $pass );

I figured it out. 我想到了。 I have to compile the build for the .so files using the correct php-config. 我必须使用正确的php-config编译.so文件的构建。 I got 2 installs of php and I was building them with default from osx which was not matching what I was running so they were being ignored. 我安装了2次php,并使用osx的默认设置构建了php,这与我的运行不匹配,因此被忽略了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM