==== Crossplatform APC debugging ==== === Linux/Unix === == Preparing the workspace == # prepare the folder structure * mkdir ~/ws * mkdir ~/ws/src * mkdir ~/ws/root # checkout required php versions * cd ~/ws/src * svn co https://svn.php.net/repository/php/php-src/branches/PHP_5_4 php-5.4-ts * cp php-5.4-ts php-5.4-nts # yes, use the same source twice to quickly recompile ts and nts # or see that you have the correct autoconf version * export AUTOCONF="/usr/bin/autoconf2.59" * export CFLAGS="-g3 -O0 -Wall" * export CPPFLAGS=$CFLAGS * cd php-5.4-ts * ./buildconf # this is the minimal configure * ./configure --prefix=/home/user/ws/root/php-5.4-ts --disable-all --enable-debug --with-regex=php --enable-cli --enable-cgi --with-config-file-path=/home/user/ws/root/php-5.4-ts/etc/php.ini --enable-maintainer-zts * make * make install * mkdir /home/user/ws/root/php-5.4-ts/etc * cp php.ini-development /home/user/ws/root/php-5.4-ts/etc/php.ini # edit the php.ini and add the APC there extension=apc.so * cd php-5.4-ts * ./buildconf # this is the minimal configure * ./configure --prefix=/home/user/ws/root/php-5.4-nts --disable-all --enable-debug --with-regex=php --enable-cli --enable-cgi --with-config-file-path=/home/user/ws/root/php-5.4-nts/etc/php.ini --enable-maintainer-zts * make * make install * mkdir /home/user/ws/root/php-5.4-ts/etc * cp php.ini-development /home/user/ws/root/php-5.4-ts/etc/php.ini # edit the php.ini and add the APC there extension=apc.so # now we have two separate ts and nts environments, go ahead with apc * cd ~/ws/src * svn co http://svn.php.net/repository/pecl/apc/trunk apc == Building APC == # for the ts version just give another php-config * cd ~/ws/src/apc * CFLAGS="-g3 -O0 -Wall" ./configure --enable-apc --disable-apc-pthreadmutex --enable-apc-pthreadrwlocks --with-php-config=/home/user/dws/root/php-5.4-nts/bin/php-config * make * make install # this way we can quickly switch to test with different php versions == Debugging APC == # running tests * make test TESTS=-m # testing a simple php script * ZEND_DONT_UNLOAD_MODULES=1 valgrind --leak-check=full ~/dws/root/php-5.4-nts/bin/php -n -d extension_dir=.libs/ -d extension=apc.so -d apc.enable_cli=1 -d apc.stat=0 mytest.php # using gdb * ZEND_DONT_UNLOAD_MODULES=1 gdb --args ~/dws/root/php-5.4-nts/bin/php -n -d extension_dir=.libs/ -d extension=apc.so -d apc.enable_cli=1 -d apc.stat=0 -d apc.file_md5 test.php === Windows === == Preparing the workspace == * prepare the build environment https://wiki.php.net/internals/windows/stepbystepbuild == Building APC == = without debug = * download a development pack from http://windows.php.net/downloads/releases/ , for instance php-devel-pack-5.4.0-Win32-VC9-x86.zip * unpack to c:\php-devel-pack-5.4.0-Win32-VC9-x86 * checkout APC to c:\apc_trunk * start windows sdk shell * cd c:\php-sdk * setenv /debug /xp /x86 * bin\phpsdk_setvars.bat * cd C:\apc_trunk * c:\php-5.4.0-devel-VC9-x86\phpize.bat * configure --enable-apc --enable-apc-srwlock-native * nmake = with debug = * TODO == Debugging APC == = without debug = * nmake test = with debug = * TODO