dongzha0149 2018-11-12 22:22
浏览 315

无法安装PHP的mssql扩展

We're using a MSSQL db at work and I want to be able to write PHP scripts that fetches data directly from the db to my local MAMP environment. I've tried installing pdo_sqlsrv and sqlsrv using Homebrew and I've tried compiling the extensions on my own using PECL commands, but in both cases it has ended unsuccessfully with the error message:

fatal error: 'sql.h' file not found

I've been googling this problem all day and can't seem to find a solution that I can get to work/understand. I'd be grateful for any help or hints.

Computer: Macbook Pro 2018 (macOS 10.13.6)

Local environment: MAMP PRO 4.5 (PHP version: 7.2.1)

  • 写回答

1条回答 默认 最新

  • doubian0284 2018-11-14 17:45
    关注

    I found the solution here: https://github.com/Microsoft/msphpsql/issues/198

    I was missing tools provided by unixodbc, so:

    brew install unixodbc
    

    ...provided the .h file(s) I was missing. The PECL installer was then able to locate the required libraries. In case it wouldn't have worked, I would have tried:

    sudo CXXFLAGS="-I/usr/local/opt/unixodbc/include" LDFLAGS="-L/usr/local/lib" pecl install pdo_sqlsrv
    sudo CXXFLAGS="-I/usr/local/opt/unixodbc/include" LDFLAGS="-L/usr/local/lib" pecl install sqlsrv
    

    ...as suggested in the link.

    评论

报告相同问题?

悬赏问题

  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 luckysheet
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码
  • ¥50 随机森林与房贷信用风险模型
  • ¥50 buildozer打包kivy app失败
  • ¥30 在vs2022里运行python代码
  • ¥15 不同尺寸货物如何寻找合适的包装箱型谱