I have macOS Monterey (M1 Pro), and would like to install sqlsrv and pdo_sqlsrv for connecting my php application (php7.4 laravel) to SQLserver DB. I follow https://www.microsoft.com/en-us/sql-server/developer-get-started/php/mac/?rtc=1 to install the environment. However, when I do sudo pecl install sqlsrv,
I got the following error
...
configure: patching config.h.in
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/sh /private/tmp/pear/temp/pear-build-rootmUMiMZ/sqlsrv-5.10.0beta2/libtool --mode=compile g++ -std=c++11 -I. -I/private/tmp/pear/temp/sqlsrv -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-rootmUMiMZ/sqlsrv-5.10.0beta2/include -I/private/tmp/pear/temp/pear-build-rootmUMiMZ/sqlsrv-5.10.0beta2/main -I/private/tmp/pear/temp/sqlsrv -I/opt/homebrew/Cellar/php@7.4/7.4.27/include/php -I/opt/homebrew/Cellar/php@7.4/7.4.27/include/php/main -I/opt/homebrew/Cellar/php@7.4/7.4.27/include/php/TSRM -I/opt/homebrew/Cellar/php@7.4/7.4.27/include/php/Zend -I/opt/homebrew/Cellar/php@7.4/7.4.27/include/php/ext -I/opt/homebrew/Cellar/php@7.4/7.4.27/include/php/ext/date/lib -I/private/tmp/pear/temp/sqlsrv/shared/ -DHAVE_CONFIG_H -std=c++11 -D_FORTIFY_SOURCE=2 -O2 -fstack-protector -c /private/tmp/pear/temp/sqlsrv/conn.cpp -o conn.lo
mkdir .libs
g++ -std=c++11 -I. -I/private/tmp/pear/temp/sqlsrv -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-rootmUMiMZ/sqlsrv-5.10.0beta2/include -I/private/tmp/pear/temp/pear-build-rootmUMiMZ/sqlsrv-5.10.0beta2/main -I/private/tmp/pear/temp/sqlsrv -I/opt/homebrew/Cellar/php@7.4/7.4.27/include/php -I/opt/homebrew/Cellar/php@7.4/7.4.27/include/php/main -I/opt/homebrew/Cellar/php@7.4/7.4.27/include/php/TSRM -I/opt/homebrew/Cellar/php@7.4/7.4.27/include/php/Zend -I/opt/homebrew/Cellar/php@7.4/7.4.27/include/php/ext -I/opt/homebrew/Cellar/php@7.4/7.4.27/include/php/ext/date/lib -I/private/tmp/pear/temp/sqlsrv/shared/ -DHAVE_CONFIG_H -std=c++11 -D_FORTIFY_SOURCE=2 -O2 -fstack-protector -c /private/tmp/pear/temp/sqlsrv/conn.cpp -fno-common -DPIC -o .libs/conn.o
In file included from /private/tmp/pear/temp/sqlsrv/conn.cpp:24:
In file included from /private/tmp/pear/temp/sqlsrv/php_sqlsrv_int.h:25:
In file included from /private/tmp/pear/temp/sqlsrv/shared/core_sqlsrv.h:41:
In file included from /private/tmp/pear/temp/sqlsrv/shared/FormattedPrint.h:24:
In file included from /private/tmp/pear/temp/sqlsrv/shared/xplat_winnls.h:24:
In file included from /private/tmp/pear/temp/sqlsrv/shared/typedefs_for_linux.h:23:
/private/tmp/pear/temp/sqlsrv/shared/xplat.h:30:10: fatal error: 'sql.h' file not found
#include <sql.h>
^~~~~~~
1 error generated.
make: *** [conn.lo] Error 1
ERROR: `make' failed
I also follow https://github.com/microsoft/msphpsql/issues/373 to check $path
local % pecl config-show
Configuration (channel pecl.php.net):
=====================================
Auto-discover new Channels auto_discover <not set>
Default Channel default_channel pecl.php.net
HTTP Proxy Server Address http_proxy <not set>
PEAR server [DEPRECATED] master_server pear.php.net
Default Channel Mirror preferred_mirror pecl.php.net
Remote Configuration File remote_config <not set>
PEAR executables directory bin_dir /opt/homebrew/opt/php@7.4/bin
PEAR documentation directory doc_dir /opt/homebrew/share/pear@7.4/doc
PHP extension directory ext_dir /opt/homebrew/lib/php/pecl/20190902
PEAR directory php_dir /opt/homebrew/share/pear@7.4
PEAR Installer cache directory cache_dir /private/tmp/pear/cache
PEAR configuration file cfg_dir /opt/homebrew/share/pear@7.4/cfg
directory
PEAR data directory data_dir /opt/homebrew/share/pear@7.4/data
PEAR Installer download download_dir /private/tmp/pear/download
directory
Systems manpage files man_dir /opt/homebrew/share/man
directory
PEAR metadata directory metadata_dir <not set>
PHP CLI/CGI binary php_bin /opt/homebrew/opt/php@7.4/bin/php
php.ini location php_ini /opt/homebrew/etc/php/7.4/php.ini
--program-prefix passed to php_prefix <not set>
PHP's ./configure
--program-suffix passed to php_suffix <not set>
PHP's ./configure
PEAR Installer temp directory temp_dir /private/tmp/pear/temp
PEAR test directory test_dir /opt/homebrew/share/pear@7.4/test
PEAR www files directory www_dir /opt/homebrew/share/pear@7.4/htdocs
Cache TimeToLive cache_ttl 3600
Preferred Package State preferred_state stable
Unix file mask umask 22
Debug Log Level verbose 1
PEAR password (for password <not set>
maintainers)
Signature Handling Program sig_bin /usr/local/bin/gpg
Signature Key Directory sig_keydir /opt/homebrew/etc/php/7.4/pearkeys
Signature Key Id sig_keyid <not set>
Package Signature Type sig_type gpg
PEAR username (for username <not set>
maintainers)
User Configuration File Filename /Users/angelachan-tactile/.pearrc
System Configuration File Filename /opt/homebrew/etc/php/7.4/pear.conf
on echo $path
:
/opt/homebrew/opt/php@7.4/sbin /opt/homebrew/opt/php@7.4/bin /opt/homebrew/bin /opt/homebrew/sbin /usr/local/bin /usr/bin /bin /usr/sbin /sbin
on find / -name sql.h
:
/opt/homebrew/include/sql.h
/opt/homebrew/Cellar/unixodbc/2.3.9_1/include/sql.h
Did I miss any configuration to install sqlsrv and pdo_sqsrv?
Thanks