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 5 extra extensions
#pecl install amqp (https://pecl.php.net/package/amqp)
#pecl install mongo (https://pecl.php.net/package/mongo)
#pecl install php-psr (https://github.com/jbboehr/php-psr)
#pecl install redis (https://pecl.php.net/package/redis)
#pecl install swoole-src (https://github.com/swoole/swoole-src)
;;;;;;;;;;;;;;;;;;;;;;;;
; PHP configure list ;
;;;;;;;;;;;;;;;;;;;;;;;;
./configure
--with-amqp
--with-librabbitmq-dir[=DIR]
--disable-ctype
--with-curl=DIR
--disable-fileinfo
--without-iconv
--disable-libxml
--enable-mbstring
--with-libmbfl=DIR
--enable-mbstr-enc-trans
--disable-mbregex
--enable-mongodb
--with-openssl-dir[=DIR]
--with-system-ciphers
--disable-pdo
--without-pear
--disable-posix
--enable-psr
--enable-redis
--disable-redis-session
--enable-redis-igbinary
--disable-session
--enable-sockets
--enable-soap
--without-sqlite3
--with-swoole
--enable-swoole-debug, --enable-sockets, --enable-ringbuffer, --enable-async-redis, --enable-openssl, --enable-http2, --enable-thread, --enable-hugepage, --enable-swoole, --enable-mysqlnd, --enable-coroutine, --enable-picohttpparser, --enable-timewheel
--disable-tokenizer
--disable-xml
--with-xmlrpc[=DIR]
--disable-xmlwriter
; For debug purposes
;--enable-dtrace
;--disable-phpdbg
;--enable-zend-signals
;--disable-opcache