Apply patch from 'biesbjerg' to ApcEngine

This set of changes allows ApcEngine to work with APCu and newer
versions of APC.

Fixes #3749