简体   繁体   English

尝试从Ubuntu PHP服务器连接到MSSQL

[英]Trying to connect to MSSQL from Ubuntu PHP Server

So I've gone around in circles for a few days now and I need help. 因此,我已经圈了几天,我需要帮助。

The setup. 设置。

  • Laravel Homestead VM Laravel Homestead VM
  • Ubuntu 16.04.1 LTS Ubuntu 16.04.1 LTS
  • PHP 7.1.11-1 PHP 7.1.11-1

The problem: 问题:

I have a simple script setup to test a DB connection. 我有一个简单的脚本设置来测试数据库连接。 Whenever I hit the script though and it trys I get the following error: 但是,无论何时我点击脚本,它都会尝试以下错误:

This extension requires the Microsoft ODBC Driver 11 or 13 for SQL Server. Access the following URL to download the ODBC Driver 11 or 13 for SQL Server for x64: http://go.microsoft.com/fwlink/?LinkId=163712

What I've Done: 我所做的:

So, I have the latest and greatest SQL Server drivers installed. 因此,我安装了最新和最好的SQL Server驱动程序。 If you follow this link Microsoft Drivers for PHP for SQL Server , you'll find that when you download them, MS gives you a really good guide. 如果您单击此链接Microsoft SQL Server驱动程序for SQL Server ,您将发现在下载它们时,MS为您提供了非常好的指南。 I have the extensions correctly (I think) being called from within my php.ini files (FPM, Apache2, and CLI). 我有正确的扩展名(我认为)是从我的php.ini文件(FPM,Apache2和CLI)中调用的。

Somewhere I read that there's a problem connecting to SQL Server 12. So I actually downloaded and installed a preview version of the PDO and Sqlsrv drivers that MS offered, and still same error. 我在某个地方读到连接到SQL Server 12时遇到问题。因此,我实际上下载并安装了MS提供的PDO和Sqlsrv驱动程序的预览版,并且仍然存在相同的错误。

Lastly, I followed this instructional guide PHP Ubuntu MS SQL after a search, and low and behold, from the command line, using sqlcmd I can connect, but still from the script... nothing. 最后,我在使用sqlcmd从命令行中搜索并低调地查看了PHP Ubuntu Ubuntu MS SQL之后,仍然可以从脚本中进行连接……什么也没有。

I don't know where to go from here. 我不知道从这里去哪里。

So, after running through this tut again, it's seemingly working. 因此,在再次运行此Tut之后,它似乎正在工作。

https://www.microsoft.com/en-us/sql-server/developer-get-started/php/ubuntu/step/2.html https://www.microsoft.com/zh-cn/sql-server/developer-get-started/php/ubuntu/step/2.html

So, not exactly sure what it could be. 因此,不完全确定会是什么。

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

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