msphpsql: Error to Install sqlsrv with pecl on MacOS

Any help would be greatly appreciated. Sorry if I use the Markdown incorrectly.

sudo pecl install sqlsrv WARNING: channel “pecl.php.net” has updated its protocols, use “pecl channel-update pecl.php.net” to update downloading sqlsrv-5.6.1.tgz … Starting to download sqlsrv-5.6.1.tgz (183,396 bytes) …done: 183,396 bytes 34 source files, building running: phpize grep: /usr/include/php/main/php.h: No such file or directory grep: /usr/include/php/Zend/zend_modules.h: No such file or directory grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory Configuring for: PHP Api Version: Zend Module Api No: Zend Extension Api No: building in /private/tmp/pear/install/pear-build-rootQ8Q9xG/sqlsrv-5.6.1 running: /private/tmp/pear/install/sqlsrv/configure --with-php-config=/usr/bin/php-config checking for grep that handles long lines and -e… /usr/bin/grep checking for egrep… /usr/bin/grep -E checking for a sed that does not truncate output… /usr/bin/sed checking for cc… cc checking whether the C compiler works… yes checking for C compiler default output file name… a.out checking for suffix of executables… checking whether we are cross compiling… no checking for suffix of object files… o checking whether we are using the GNU C compiler… yes checking whether cc accepts -g… yes checking for cc option to accept ISO C89… none needed checking how to run the C preprocessor… cc -E checking for icc… no checking for suncc… no checking whether cc understands -c and -o together… yes checking for system library directory… lib checking if compiler supports -R… no checking if compiler supports -Wl,-rpath,… yes checking build system type… x86_64-apple-darwin18.7.0 checking host system type… x86_64-apple-darwin18.7.0 checking target system type… x86_64-apple-darwin18.7.0 checking for PHP prefix… /usr checking for PHP includes… -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib checking for PHP extension directory… /usr/lib/php/extensions/no-debug-non-zts-20160303 checking for PHP installed headers prefix… /usr/include/php checking if debug is enabled… no checking if zts is enabled… no checking for re2c… no configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers. checking for gawk… no checking for nawk… no checking for awk… awk checking if awk is broken… no checking whether to enable sqlsrv functions… yes, shared checking for SQLSRV headers… /private/tmp/pear/install/sqlsrv/shared/ checking for g++… g++ checking whether we are using the GNU C++ compiler… yes checking whether g++ accepts -g… yes checking how to run the C++ preprocessor… g++ -E checking for ld used by cc… /Library/Developer/CommandLineTools/usr/bin/ld checking if the linker (/Library/Developer/CommandLineTools/usr/bin/ld) is GNU ld… no checking for /Library/Developer/CommandLineTools/usr/bin/ld option to reload object files… -r checking for BSD-compatible nm… /usr/bin/nm -B checking whether ln -s works… yes checking how to recognize dependent libraries… pass_all checking for ANSI C header files… yes checking for sys/types.h… yes checking for sys/stat.h… yes checking for stdlib.h… yes checking for string.h… yes checking for memory.h… yes checking for strings.h… yes checking for inttypes.h… yes checking for stdint.h… yes checking for unistd.h… yes checking dlfcn.h usability… yes checking dlfcn.h presence… yes checking for dlfcn.h… yes checking how to run the C++ preprocessor… g++ -E checking the maximum length of command line arguments… 196608 checking command to parse /usr/bin/nm -B output from cc object… ok checking for objdir… .libs checking for ar… ar checking for ranlib… ranlib checking for strip… strip checking for dsymutil… dsymutil checking for nmedit… nmedit checking for -single_module linker flag… yes checking for -exported_symbols_list linker flag… yes checking if cc supports -fno-rtti -fno-exceptions… yes checking for cc option to produce PIC… -fno-common checking if cc PIC flag -fno-common works… yes checking if cc static flag -static works… no checking if cc supports -c -o file.o… yes checking whether the cc linker (/Library/Developer/CommandLineTools/usr/bin/ld) supports shared libraries… yes checking dynamic linker characteristics… darwin18.7.0 dyld checking how to hardcode library paths into programs… immediate checking whether stripping libraries is possible… yes checking if libtool supports shared libraries… yes checking whether to build shared libraries… yes checking whether to build static libraries… no

creating libtool appending configuration tag “CXX” to libtool checking for ld used by g++… /Library/Developer/CommandLineTools/usr/bin/ld checking if the linker (/Library/Developer/CommandLineTools/usr/bin/ld) is GNU ld… no checking whether the g++ linker (/Library/Developer/CommandLineTools/usr/bin/ld) supports shared libraries… yes checking for g++ option to produce PIC… -fno-common checking if g++ PIC flag -fno-common works… yes checking if g++ static flag -static works… no checking if g++ supports -c -o file.o… yes checking whether the g++ linker (/Library/Developer/CommandLineTools/usr/bin/ld) supports shared libraries… yes checking dynamic linker characteristics… darwin18.7.0 dyld (cached) (cached) checking how to hardcode library paths into programs… immediate configure: creating ./config.status config.status: creating config.h running: make /bin/sh /private/tmp/pear/install/pear-build-rootQ8Q9xG/sqlsrv-5.6.1/libtool --mode=compile g++ -std=c++11 -I. -I/private/tmp/pear/install/sqlsrv -DPHP_ATOM_INC -I/private/tmp/pear/install/pear-build-rootQ8Q9xG/sqlsrv-5.6.1/include -I/private/tmp/pear/install/pear-build-rootQ8Q9xG/sqlsrv-5.6.1/main -I/private/tmp/pear/install/sqlsrv -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/private/tmp/pear/install/sqlsrv/shared/ -DHAVE_CONFIG_H -std=c++11 -D_FORTIFY_SOURCE=2 -O2 -fstack-protector -c /private/tmp/pear/install/sqlsrv/conn.cpp -o conn.lo mkdir .libs g++ -std=c++11 -I. -I/private/tmp/pear/install/sqlsrv -DPHP_ATOM_INC -I/private/tmp/pear/install/pear-build-rootQ8Q9xG/sqlsrv-5.6.1/include -I/private/tmp/pear/install/pear-build-rootQ8Q9xG/sqlsrv-5.6.1/main -I/private/tmp/pear/install/sqlsrv -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/private/tmp/pear/install/sqlsrv/shared/ -DHAVE_CONFIG_H -std=c++11 -D_FORTIFY_SOURCE=2 -O2 -fstack-protector -c /private/tmp/pear/install/sqlsrv/conn.cpp -fno-common -DPIC -o .libs/conn.o In file included from /private/tmp/pear/install/sqlsrv/conn.cpp:21: /private/tmp/pear/install/sqlsrv/php_sqlsrv.h:25:10: fatal error: ‘php.h’ file not found #include “php.h” ^~~~~~~ 1 error generated. make: *** [conn.lo] Error 1 ERROR: `make’ failed

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 30 (16 by maintainers)

Most upvoted comments

That error message about cd is unexpected and makes no sense 😦

Anyway, try to clean up all php in your Mojave:

brew update
brew upgrade
brew cleanup

# Check if you have old deprecated Homebrew PHP versions and extensions installed
brew list | grep php

# Uninstall deprecated Homebrew PHP, every one of them:
brew unlink php@5.5
brew unlink php@5.6
brew unlink php@7.0
brew unlink php@7.1
brew unlink php@7.2
brew unlink php@7.3
brew unlink php
brew cleanup

brew uninstall --force php@5.5
brew uninstall --force php@5.6
brew uninstall --force php@7.0
brew uninstall --force php@7.1
brew uninstall --force php@7.2
brew uninstall --force php@7.3

# Check that no deprecated Homebrew PHP packages are left
brew cleanup
brew list | grep php

# Remove all old PHP configurations
rm -Rf /usr/local/etc/php/*

Then follow the instructions again, but this time make sure you get php installed correctly and check all my replies above.

As a last resort, uninstall homebrew and reinstall afterwards.

Once again, good luck!