1,编译debug版的php
git clone https://github.com/php/php-src.git
cd php-src
./configure --prefix=/opt/php-debug --enable-debug --enable-cli --without-pear --enable-embed
make
make install
mkdir /opt/php-debug/conf/
cp php.ini-development /opt/php-debug/conf/php.ini
2,创建debug信息的扩展
./ext_skel --extname=hello2
cd hello2
#vi config.m4
#添加下面信息
if test -z "$PHP_DEBUG"; then
AC_ARG_ENABLE(debug,
[ --enable-debug compile with debugging symbols],[
PHP_DEBUG=$enableval
],[ PHP_DEBUG=no
])
fi
/opt/php-debug/bin/phpize
./configure --with-php-config=/opt/php-debug/bin/php-config --enable-debug
make
sudo make install
3