🥐

Install the SQL Server Driver for PHP on M1 Macbook

2022/08/30に公開

Issue

sudo pecl install sqlsrv-5.10.1 and sudo pecl install pdo_sqlsrv-5.10.1 exit with an error saying 'sql.h' file not found on M1 Mac.

Solution

  1. brew install unixodbc
  2. 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

For more details, please refer to an installation guide by Microsoft.

Discussion