This is a suggestion of compilation directive to use when compiling PHP specifically for the audited code.
The selection made below is based on the extension usage, found in the code (--enable, --with) and also the absence of usage (--disable, --without).
Some local extensions (--pdo-mysql, --with-libmbfl...) are also mentionned for help.
# install 7 extra extensions
#pecl install geoip (https://pecl.php.net/package/geoip)
#pecl install igbinary (https://pecl.php.net/package/igbinary)
#pecl install memcached (https://pecl.php.net/package/memcached)
#pecl install memcached (https://pecl.php.net/package/memcached)
#pecl install mongo (https://pecl.php.net/package/mongo)
#pecl install redis (https://pecl.php.net/package/redis)
#pecl install xcache.lighttpd.net (https://xcache.lighttpd.net/)
;;;;;;;;;;;;;;;;;;;;;;;;
; PHP configure list ;
;;;;;;;;;;;;;;;;;;;;;;;;
./configure
--with-apxs2
--enable-calendar
--with-curl=DIR
--enable-fpm
--with-fpm-user
--with-fpm-group
--with-fpm-systemd
--with-fpm-acl
--with-gd
--with-jpeg-dir=DIR
--with-png-dir=DIR
--with-xpm-dir=DIR
--with-vpx-dir=DIR
--with-freetype-dir=DIR
--enable-gd-native-ttf
--with-geoip=DIR
--disable-hash
--without-iconv
--with-igbinary
--with-ldap[=DIR]
--with-ldap-sasl[=DIR]
--enable-mbstring
--with-libmbfl=DIR
--enable-mbstr-enc-trans
--disable-mbregex
--enable-memcache
--disable-memcache-session
--with-libmemcached-dir=DIR
--with-zlib-dir=DIR
--disable-memcached-session
--enable-memcached-sasl
--enable-mongodb
--with-openssl-dir[=DIR]
--with-system-ciphers
--with-openssl[=DIR]
--enable-pcntl
--enable-pdo
--with-pdo-odbc
--with-pdo-mysql
--with-pdo-pgsql
--with-pdo-oci
--with-pdo-firebird
--with-pdo-dblib
--with-pdo-cubrid
--disable-posix
--enable-redis
--disable-redis-session
--enable-redis-igbinary
--enable-simplexml
--enable-sockets
--without-sqlite3
--enable-xcache
--enable-xcache-optimizer
--enable-xcache-coverager
--enable-xcache-assembler
--enable-xcache-disassembler
--enable-xcache-encoder
--enable-xcache-decoder
--enable-xcache-test
--disable-xml
--disable-xmlreader
--disable-xmlwriter
--with-zlib=DIR
; For debug purposes
;--enable-dtrace
;--disable-phpdbg
;--enable-zend-signals
;--disable-opcache