Installing php apd on php 5.3.10

Today I wanted to extend the phpdebugtoolbar to allow tracing for good old mysql_query commands. This can be possible by using the

rename_function-method, which is provided by the apd pecl extension. It's a pitty that this extension cannot be compiled for php >= 5.3 without any patch. So here the step by step guide to get it up and running on a php 5.3 or later. 1. Download apd-1.0.1.tar.gz from pecl.php.net. 2. Extract the files 3. Patch the code

diff --git a/php_apd.c b/php_apd.c
index 6707e02..8bfafb5 100644
--- a/php_apd.c
+++ b/php_apd.c
@@ -964,7 +964,7 @@ ZEND_DLEXPORT void onStatement(zend_op_array *op_array)
 int apd_zend_startup(zend_extension *extension)
-       CG(extended_info) = 1;  /* XXX: this is ridiculous */
+       CG(compiler_options) |= ZEND_COMPILE_EXTENDED_INFO;
        return zend_startup_module(&apd_module_entry);
  1. Run

phpize to configure the extension. 5. Run make to build the extension 6. Run sudo make install to copy the .so to the necessary location 7. Add this line to your php.ini (the folder may be different on your system)


That's it. If you receive the error message, that apd.so is not a valid extension, you must use "zend_extension=" and not "extension=" to configure the extension properly! Call

$ php --version
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
    with Advanced PHP Debugger (APD) v1.0.1, , by George Schlossnagle
    with Xdebug v2.1.2, Copyright (c) 2002-2011, by Derick Rethans

and the Advanved PHP Debugger info appears.

In open source, php by
@ 26 Apr 2012, Comments at Reddit & Hackernews

Give something back

Were my blog posts useful to you? If you want to give back, support one of these charities, too!

Report hate in social media Campact e.V. With our technology and your help, we protect the oceans from plastic waste. Gesellschaft fur Freiheitsrechte e. V. The civil eye in the mediterranean

Recent Dev-Articles

Read recently

Recent Files