dongpian2559 2018-11-23 08:11
浏览 98
已采纳

使用适用于SQL Server的PHP的Microsoft驱动程序连接到Ubuntu 16.04上的PHP 7.2中的SQL Server,在浏览器中工作但在命令行中失败

I'm trying connecting a remote SQL Server database and getting its data for writting to my local Mysql database on Ubuntu. I've been using Microsoft Drivers for PHP for SQL Server (ODBC driver installed) and it works in the browsers.

But while I run it in command-line, it shows could not find driver, just like the Driver is never installed.

My environment:

  1. Ubuntu 16.04.5
  2. PHP 7.0.32
  3. Apache 2.4.18
  4. MySQL 5.7.24

The remote server is Windows Server 2012 with SQL Server 14.0.1000.

I've configured my Apache and PHP correctly followed the official tutorial (otherwise it probably could not work even in the browser), so I don't know why it doesn't work in the command-line or terminal. Please help, thanks.

  • 写回答

1条回答 默认 最新

  • dreamer2014520 2018-11-23 09:01
    关注

    You have to enable this driver in the CLI php.ini file.

    To find this file, open a console and type php --ini, this will show you the path of the current php CLI ini file.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?