只说重点./configure --prefix=/usr/local/php7 --with-config-file-path=/usr/local/php7/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysqli --with-pdo-mysql --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext=/usr/local/Cellar/gettext/0.19.8.1/ --disable-fileinfo --enable-maintainer-zts --with-png-dir=/usr/local/libpng --with-pdo-pgsql=/Applications/Postgres.app/Contents/Versions/9.5/ --with-openssl=/usr/local/Cellar/openssl/1.0.1j/
php configure: error: Cannot find libz
xcode-select --install
configure: error: Cannot locate header file libintl.hbrew install gettext
--with-gettext=/usr/local/Cellar/gettext/0.19.8.1/
configure都通过后make出错
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [sapi/cli/php] Error 1
【解决】
修改 Makefile 文件
找到 EXTRA_LIBS 节点,大概140行左右,删除所有的 -lssl 和 -lcrypto 然后追加 libssl.dylib 和
libcrypto.dylib 的路径(如果你安装了 brew,那么则是 /usr/local/opt/openssl/lib/),运行
make clean后再运行make命令。
附上我修改后的 MakeFile EXTRA_LIBS 那一行:EXTRA_LIBS = -lz -lresolv -lpq -lmcrypt -lltdl -liconv -liconv -lintl -lpng -lz -lcurl -lz -lm -lpthread -lxml2 -lz -licucore -lm -lcurl -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm /usr/local/opt/openssl/lib/libssl.dylib /usr/local/opt/openssl/lib/libcrypto.dylib