msphpsql: /private/tmp/pear/temp/sqlsrv/shared/xplat.h:30:10: fatal error: 'sql.h' file not found

+## Driver version or file name +Please tell us what the PHP driver version or file name is. +5.2.0-RC +## SQL Server version +Please tell us what the SQL Server version is. +4.1.7 +## Client operating system +Please tell us what oprating system the client program is running on.

  • macOS 10.12.6 (16G1114) +## PHP version +Please tell us which version of PHP you are running.
  • 7.1.12 +## Microsoft ODBC Driver version +Please tell us which version of the Microsoft ODBC Driver you are using.
  • 13.1.9.0 +## Table schema +Please tell us the table schema
  • N/A +## Problem description +Please share more details with us.
  • running sudo pecl install sqlsrv returns error: /private/tmp/pear/temp/sqlsrv/shared/xplat.h:30:10: fatal error: ‘sql.h’ file not found +## Expected behavior and actual behavior +Please tell us what should happen and what happened instead
  • No error and make to finish properly +## Repro code +Please share repro code with us, or tell us how to reproduce the issue. follow your instructions for php 7.1 and on macOS

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 37 (16 by maintainers)

Most upvoted comments

Hi, I had the same issue on MAC mini M1, however I was able to solve it in the following way:

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

“… add the CXXFLAGS & LDFLAGS to point to unixodbc headers files and lib path, this helps to compile the modules with pecl…”

i took the guide from: https://github.com/microsoft/msphpsql/issues/198#issuecomment-326139609

hope it helpful

This will resolve it:

sudo apt-get install unixodbc-dev

So glad to hear that @zrubinrattet ! May I close the issue?