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 memcached (https://pecl.php.net/package/memcached)
#pecl install memcached (https://pecl.php.net/package/memcached)
#pecl install redis (https://pecl.php.net/package/redis)
#pecl install SeasLog (http://seasx.github.io/SeasLog/)
#pecl install sqlsrv (https://pecl.php.net/package/sqlsrv)
#pecl install suhosin.org (https://suhosin.org/)
#pecl install zookeeper (https://pecl.php.net/package/zookeeper)
;;;;;;;;;;;;;;;;;;;;;;;;
; PHP configure list ;
;;;;;;;;;;;;;;;;;;;;;;;;
./configure
--with-apxs2
--enable-calendar
--disable-dom
--enable-ftp
--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
--enable-intl
--with-interbase[=DIR]
--disable-json
--disable-libxml
--enable-mbstring
--with-libmbfl=DIR
--enable-mbstr-enc-trans
--disable-mbregex
--with-mcrypt=[DIR]
--enable-memcache
--disable-memcache-session
--with-libmemcached-dir=DIR
--with-zlib-dir=DIR
--disable-memcached-session
--enable-memcached-sasl
--with-mssql=[DIR]
--enable-msdblib
--with-mysqli
--with-nsapi=DIR
--enable-libgcc
--with-oci8
--with-unixodbc[=DIR]
--with-adabas[=DIR]
--with-sapdb[=DIR]
--with-solid[=DIR]
--with-ibm-db2[=DIR]
--with-empress[=DIR]
--with-empress-bcs[=DIR]
--with-birdstep[=DIR]
--with-custom-odbc[=DIR]
--with-iodbc[=DIR]
--with-esoob[=DIR]
--with-openlink[=DIR]
--with-dbmaker[=DIR]
--with-openssl[=DIR]
--enable-pdo
--with-pdo-odbc
--with-pdo-mysql
--with-pdo-pgsql
--with-pdo-oci
--with-pdo-firebird
--with-pdo-dblib
--with-pdo-cubrid
--without-pear
--with-pgsql=[DIR]
--disable-posix
--enable-redis
--disable-redis-session
--enable-redis-igbinary
--with-seaslog
--with-sqlsrv=DIR
--enable-suhosin
--enable-suhosin-experimental
--disable-tokenizer
--disable-xmlreader
--with-xmlrpc[=DIR]
--disable-xmlwriter
--with-zlib=DIR
--enable-zookeeper
--disable-zookeeper-session
--with-libzookeeper-dir[=DIR]
; For debug purposes
;--enable-dtrace
;--disable-phpdbg
;--enable-zend-signals
;--disable-opcache