How to install pecl-apd with PHP 5.4 on FreeBSD


February 2013.
This was written on 2013-02-02.

Fetch source (revision was 297236 at the time).

# svn co http://svn.php.net/repository/pecl/apd/trunk

Apply the following patch:

diff -Naurp php-pecl-apd-1.0.2/apd-1.0.2/php_apd.c php-pecl-apd-1.0.2-patched/apd-1.0.2/php_apd.c
--- php-pecl-apd-1.0.2/apd-1.0.2/php_apd.c 2012-08-04 11:12:58.000000000 -0700
+++ php-pecl-apd-1.0.2-patched/apd-1.0.2/php_apd.c 2012-08-04 12:00:15.000000000 -0700
@@ -337,7 +337,7 @@ char *apd_get_active_function_name(zend_
}
}
else {
- switch (execd->opline->op2.u.constant.value.lval) {
+ switch (execd->opline->extended_value) {
case ZEND_EVAL:
funcname = estrdup("eval");
break;
@@ -441,8 +441,8 @@ static void log_time(TSRMLS_D)
if(utime || stime || rtime) {
int lineno = 0;
if(EG(active_op_array)) {
- if(EG(active_op_array)->start_op) {
- lineno = EG(active_op_array)->start_op->lineno;
+ if(EG(start_op)) {
+ lineno = EG(start_op)->lineno;
} else if(EG(active_op_array)->opcodes) {
lineno = EG(active_op_array)->opcodes->lineno;
}

Configure and build:

# phpize
# ./configure
# make

Install:

# make install

Load:

zend_extension = "/usr/local/lib/php/20100525/apd.so"
apd.dumpdir="/var/tmp/apd"