参考 https://www.jianshu.com/p/f6af567b25a7
一、编译安装 debug 版本的 PHP
configure php
1
2
3
4
5
6./configure --enable-fpm --enable-debug --with-openssl=/usr/local/Cellar/openssl@1.1/1.1.1i/ \
--enable-bcmath --with-curl --enable-exif --with-mysqli --with-pdo-mysql \
--enable-zip --with-zlib=/usr/local/Cellar/zlib/1.2.11/ --enable-intl --enable-pcntl --enable-mbstring --enable-soap \
--with-icu-dir=/usr/local/Cellar/icu4c/67.1 \
--with-iconv=/usr/local/Cellar/libiconv/1.16 \
--with-libxml-dir=/usr/local/Cellar/libxml2/2.9.10_2修改 makefile
查找关键字 EXTRA_LIBS =
我的在 line 108,删除所有的 -liconv
,末尾加上 /usr/local/opt/libiconv/lib/libiconv.dylib
1
2
3
4
5# 修改前
EXTRA_LIBS = -lcrypto -lssl -lcrypto -lz -lresolv -lstdc++ -liconv -liconv -lz -lcrypto -lssl -lcrypto -lm -lxml2 -lz -liconv -lm -lcurl -lxml2 -lz -liconv -lm -licui18n -licuuc -licudata -licuio -lxml2 -lz -liconv -lm -lxml2 -lz -liconv -lm -lxml2 -lz -liconv -lm -lxml2 -lz -liconv -lm -lxml2 -lz -liconv -lm
# 修改后
EXTRA_LIBS = -lcrypto -lssl -lcrypto -lz -lresolv -lstdc++ -lz -lcrypto -lssl -lcrypto -lm -lxml2 -lz -lm -lcurl -lxml2 -lz -lm -licui18n -licuuc -licudata -licuio -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm /usr/local/opt/libiconv/lib/libiconv.dylib
make
1
make
sudo make install
1
sudo make install
二、设定一些目录的权限,不然 Clion 不能正常调试
1 | sudo chown -R rovast:wheel /usr/local/lib/php/ |
makefile
1 | cmake_minimum_required(VERSION 3.13) |
debug on ubuntu
1 | sudo apt install libxml2-dev |