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 6 extra extensions
#pecl install memcached (https://pecl.php.net/package/memcached)
#pecl install pspell (https://pecl.php.net/package/pspell)
#pecl install php-psr (https://github.com/jbboehr/php-psr)
#pecl install tidy (https://pecl.php.net/package/tidy)
#pecl install xdebug (https://pecl.php.net/package/xdebug)
#pecl install xdebug (https://pecl.php.net/package/xdebug)
;;;;;;;;;;;;;;;;;;;;;;;;
; PHP configure list ;
;;;;;;;;;;;;;;;;;;;;;;;;
./configure
--with-apxs2
--enable-bcmath
--enable-calendar
--with-curl=DIR
--enable-dba=shared
--with-dbm=DIR
--with-ndbm=DIR
--with-db2=DIR
--with-db3=DIR
--with-db4=DIR
--with-cdb=DIR
--with-flatfile
--with-inifile
--with-qdbm=DIR
--with-tcadb=DIR
--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-imap=DIR
--with-imap-ssl=DIR
--with-kerberos=DIR
--enable-intl
--with-ldap[=DIR]
--with-ldap-sasl[=DIR]
--enable-mbstring
--with-libmbfl=DIR
--enable-mbstr-enc-trans
--disable-mbregex
--with-mcrypt=[DIR]
--with-libmemcached-dir=DIR
--with-zlib-dir=DIR
--disable-memcached-session
--enable-memcached-sasl
--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
--with-pspell[=dir]
--enable-psr
--enable-sysvsem
--enable-shmop
--enable-simplexml
--enable-sockets
--enable-soap
--without-sqlite3
--enable-tidy=[DIR]
--with-xdebug
--enable-xdiff=DIR
--disable-xmlreader
--disable-xmlwriter
--with-xsl[=DIR]
--enable-zip
--with-libzip=DIR
--with-zlib=DIR
; For debug purposes
;--enable-dtrace
;--disable-phpdbg
;--enable-zend-signals
;--disable-opcache