Compiling PHP with modified DEBUG_ZEND level
I'm debugging a PHP extension and found this while poking through the PHP source code:
#if DEBUG_ZEND>=2
printf("Reducing refcount for %x (%x): %d->%d\n", *zval_ptr, zval_ptr, Z_REFCOUNT_PP(zval_ptr), Z_REFCOUNT_PP(zval_ptr) - 1);
#endif
So I want to compile with DEBUG_ZEND set to 2. In Zend/zend_compile.h
, I saw:
#define DEBUG_ZEND 0
I edited that value to be 2 instead, and then tried the usual:
./configure --enable-debug
make
make
does its thing for awhile, but then I see a bunch of Reducing refcount for ...
messages and then make
fails:
make: *** [ext/phar/phar.phar] Error 255
If I set DEBUG_ZEND
back to 0, PHP compiles fine. The only reference I could find to DEBUG_ZEND
was in this bug report:
http://bugs.php.net/bug.php?id=45761
This snippet looked relevant:
I reconfigured by adding CFLAGS="-DDEBUG_ZEND=2" to the start of the configure command, did a 'make clean', then 'make' ...
So I added CFLAGS="-DDEBUG_ZEND=2"
right after the shebang in configure
and was able to compile. However, I ddin't see any extra output about refcounts when running my scripts, so I'm not really convinced it did anything.
What's the proper way of compiling PHP with DEBUG_ZEND
set to 2?
If you set the environment variable after the configure script it doesn't affect ./configure. You want to set the variable for the configure script.
CFLAGS="-DDEBUG_ZEND=2" ./configure --enable-debug
精彩评论