Custom php.ini settings - DA using php.conf.d/99-custom.ini ?

eva2000

Verified User
Joined
Jul 1, 2019
Messages
122
New to DirectAdmin so still haven't found specific examples of overriding system level php.ini options for each php-fpm version installed on the server. From the looks of it I can utilise existing php config file scan directory setups to override php.ini so use a custom .ini in /usr/local/phpXX/lib/php.conf.d/99-custom.ini where XX is 56, 72, 73 for php versions I have installed.

Question

The question I have is 99-custom.ini specifically used by DirectAdmin ? I don't want my settings in 99-custom.ini to be wiped or overriden by DirectAdmin.

I wrote my own php config command script which
  1. inspect all php-fpm versions configuration settings
  2. inspect all php-fpm versions *.ini configuration paths and settings
  3. set and add custom php configuration options into own override 99-custom.ini settings file for each php-fpm version installed and restart respective services and then inspect the new php set value

setting new custom php option
Code:
getphpconfig set max_input_vars=10000
output for my 3 php-fpm versions installed, php 5.6, 7.2, 7.3
Code:
getphpconfig set max_input_vars=10000
-------------------------------------------------------
php-config: 5.6.40
config file scan dir: /usr/local/php56/lib/php.conf.d

Usage: /usr/local/php56/bin/php-config [OPTION]
Options:
  --prefix            [/usr/local/php56]
  --includes          [-I/usr/local/php56/include/php -I/usr/local/php56/include/php/main -I/usr/local/php56/include/php/TSRM -I/usr/local/php56/include/php/Zend -I/usr/local/php56/include/php/ext -I/usr/local/php56/include/php/ext/date/lib]
  --ldflags           [ -L/usr/local/lib -L/usr/local/icu/lib]
  --libs              [-lcrypt   -lz -lexslt -lresolv -lcrypt -lrt -lmcrypt -lltdl -lstdc++ -liconv -lpng -lz -ljpeg -lcurl -lz -lpcre -lrt -lm -ldl -lnsl  -lsystemd -lxml2 -lz -liconv -lm -ldl -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lssl -lcrypto -lcurl -lxml2 -lz -liconv -lm -ldl -lssl -lcrypto -lfreetype -licui18n -licuuc -licudata -licuio -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lcrypt -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lxslt -lxml2 -lz -liconv -ldl -lm -lssl -lcrypto -lcrypt ]
  --extension-dir     [/usr/local/php56/lib/php/extensions/no-debug-non-zts-20131226]
  --include-dir       [/usr/local/php56/include/php]
  --man-dir           [/usr/local/php56/php/man]
  --php-binary        [/usr/local/php56/bin/php56]
  --php-sapis         [ cli fpm cgi]
  --configure-options [--prefix=/usr/local/php56 --program-suffix=56 --enable-fpm --with-fpm-systemd --with-config-file-scan-dir=/usr/local/php56/lib/php.conf.d --with-curl --with-gd --enable-gd-native-ttf --with-gettext --with-jpeg-dir=/usr/local/lib --with-freetype-dir=/usr/local/lib --with-libxml-dir=/usr/local/lib --with-kerberos --with-openssl --with-mcrypt --with-mhash --with-mysql=mysqlnd --with-mysql-sock=/var/lib/mysql/mysql.sock --with-mysqli=mysqlnd --with-pcre-regex=/usr/local --with-pdo-mysql=mysqlnd --with-pear --with-png-dir=/usr/local/lib --with-xsl --with-zlib --enable-zip --with-iconv=/usr/local --enable-bcmath --enable-calendar --enable-exif --enable-ftp --enable-sockets --enable-soap --enable-mbstring --with-icu-dir=/usr/local/icu --enable-intl CXXFLAGS=-std=c++11 -DU_USING_ICU_NAMESPACE=1]
  --version           [5.6.40]
  --vernum            [50640]

-------------------------------------------------------
set max_input_vars=10000
setup /usr/local/php56/lib/php.conf.d/99-custom.ini

Redirecting to /bin/systemctl restart php-fpm56.service

inspecting set php option: max_input_vars
max_input_vars => 10000 => 10000

-------------------------------------------------------
php-config: 7.2.20
config file scan dir: /usr/local/php72/lib/php.conf.d

Usage: /usr/local/php72/bin/php-config [OPTION]
Options:
  --prefix            [/usr/local/php72]
  --includes          [-I/usr/local/php72/include/php -I/usr/local/php72/include/php/main -I/usr/local/php72/include/php/TSRM -I/usr/local/php72/include/php/Zend -I/usr/local/php72/include/php/ext -I/usr/local/php72/include/php/ext/date/lib]
  --ldflags           [ -L/usr/local/lib -L/usr/local/icu/lib]
  --libs              [-lcrypt   -lz -lexslt -lresolv -lcrypt -lsodium -lrt -lstdc++ -liconv -lpng -lz -ljpeg -lwebp -lz -lpcre -lrt -lm -ldl -lnsl  -lsystemd -lxml2 -lz -liconv -lm -ldl -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lssl -lcrypto -lcurl -lxml2 -lz -liconv -lm -ldl -lssl -lcrypto -lfreetype -licui18n -licuuc -licudata -licuio -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lcrypt -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lxslt -lxml2 -lz -liconv -ldl -lm -lssl -lcrypto -lcrypt ]
  --extension-dir     [/usr/local/php72/lib/php/extensions/no-debug-non-zts-20170718]
  --include-dir       [/usr/local/php72/include/php]
  --man-dir           [/usr/local/php72/php/man]
  --php-binary        [/usr/local/php72/bin/php72]
  --php-sapis         [ cli fpm phpdbg cgi]
  --configure-options [--prefix=/usr/local/php72 --program-suffix=72 --enable-fpm --with-fpm-systemd --with-config-file-scan-dir=/usr/local/php72/lib/php.conf.d --with-curl --with-gd --with-gettext --with-jpeg-dir=/usr/local/lib --with-freetype-dir=/usr/local/lib --with-libxml-dir=/usr/local/lib --with-kerberos --with-openssl --with-mhash --with-mysql-sock=/var/lib/mysql/mysql.sock --with-mysqli=mysqlnd --with-pcre-regex=/usr/local --with-pdo-mysql=mysqlnd --with-pear --with-png-dir=/usr/local/lib --with-sodium=/usr/local --with-webp-dir=/usr/local/lib --with-xsl --with-zlib --enable-zip --with-iconv=/usr/local --enable-bcmath --enable-calendar --enable-exif --enable-ftp --enable-sockets --enable-soap --enable-mbstring --with-icu-dir=/usr/local/icu --enable-intl]
  --version           [7.2.20]
  --vernum            [70220]

-------------------------------------------------------
set max_input_vars=10000
setup /usr/local/php72/lib/php.conf.d/99-custom.ini

Redirecting to /bin/systemctl restart php-fpm72.service

inspecting set php option: max_input_vars
max_input_vars => 10000 => 10000

-------------------------------------------------------
php-config: 7.3.7
config file scan dir: /usr/local/php73/lib/php.conf.d

Usage: /usr/local/php73/bin/php-config [OPTION]
Options:
  --prefix            [/usr/local/php73]
  --includes          [-I/usr/local/php73/include/php -I/usr/local/php73/include/php/main -I/usr/local/php73/include/php/TSRM -I/usr/local/php73/include/php/Zend -I/usr/local/php73/include/php/ext -I/usr/local/php73/include/php/ext/date/lib]
  --ldflags           [ -L/usr/local/lib -L/usr/local/icu/lib]
  --libs              [-lcrypt   -lz -lexslt -lresolv -lcrypt -lsodium -lrt -lstdc++ -liconv -lpng -lz -ljpeg -lwebp -lz -lrt -lm -ldl -lnsl  -lsystemd -lxml2 -lz -liconv -lm -ldl -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lssl -lcrypto -lpcre2-8 -lcurl -lxml2 -lz -liconv -lm -ldl -lssl -lcrypto -lfreetype -licui18n -licuuc -licudata -licuio -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lcrypt -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lxslt -lxml2 -lz -liconv -ldl -lm -lssl -lcrypto -lcrypt ]
  --extension-dir     [/usr/local/php73/lib/php/extensions/no-debug-non-zts-20180731]
  --include-dir       [/usr/local/php73/include/php]
  --man-dir           [/usr/local/php73/php/man]
  --php-binary        [/usr/local/php73/bin/php73]
  --php-sapis         [ cli fpm phpdbg cgi]
  --configure-options [--prefix=/usr/local/php73 --program-suffix=73 --enable-fpm --with-fpm-systemd --with-config-file-scan-dir=/usr/local/php73/lib/php.conf.d --with-curl --with-gd --with-gettext --with-jpeg-dir=/usr/local/lib --with-freetype-dir=/usr/local/lib --with-libxml-dir=/usr/local/lib --with-kerberos --with-openssl --with-mhash --with-mysql-sock=/var/lib/mysql/mysql.sock --with-mysqli=mysqlnd --with-pcre-regex=/usr/local --with-pdo-mysql=mysqlnd --with-pear --with-png-dir=/usr/local/lib --with-sodium=/usr/local --with-webp-dir=/usr/local/lib --with-xsl --with-zlib --enable-zip --without-libzip --with-iconv=/usr/local --enable-bcmath --enable-calendar --enable-exif --enable-ftp --enable-sockets --enable-soap --enable-mbstring --with-icu-dir=/usr/local/icu --enable-intl]
  --version           [7.3.7]
  --vernum            [70307]

-------------------------------------------------------
set max_input_vars=10000
setup /usr/local/php73/lib/php.conf.d/99-custom.ini

Redirecting to /bin/systemctl restart php-fpm73.service

inspecting set php option: max_input_vars
max_input_vars => 10000 => 10000
Then inspecting each php-fpm versions php.d *.ini settings files which matter
Code:
getphpconfig ini
output
Code:
getphpconfig ini
-------------------------------------------------------
php-config: 5.6.40
config file scan dir: /usr/local/php56/lib/php.conf.d

Usage: /usr/local/php56/bin/php-config [OPTION]
Options:
  --prefix            [/usr/local/php56]
  --includes          [-I/usr/local/php56/include/php -I/usr/local/php56/include/php/main -I/usr/local/php56/include/php/TSRM -I/usr/local/php56/include/php/Zend -I/usr/local/php56/include/php/ext -I/usr/local/php56/include/php/ext/date/lib]
  --ldflags           [ -L/usr/local/lib -L/usr/local/icu/lib]
  --libs              [-lcrypt   -lz -lexslt -lresolv -lcrypt -lrt -lmcrypt -lltdl -lstdc++ -liconv -lpng -lz -ljpeg -lcurl -lz -lpcre -lrt -lm -ldl -lnsl  -lsystemd -lxml2 -lz -liconv -lm -ldl -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lssl -lcrypto -lcurl -lxml2 -lz -liconv -lm -ldl -lssl -lcrypto -lfreetype -licui18n -licuuc -licudata -licuio -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lcrypt -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lxslt -lxml2 -lz -liconv -ldl -lm -lssl -lcrypto -lcrypt ]
  --extension-dir     [/usr/local/php56/lib/php/extensions/no-debug-non-zts-20131226]
  --include-dir       [/usr/local/php56/include/php]
  --man-dir           [/usr/local/php56/php/man]
  --php-binary        [/usr/local/php56/bin/php56]
  --php-sapis         [ cli fpm cgi]
  --configure-options [--prefix=/usr/local/php56 --program-suffix=56 --enable-fpm --with-fpm-systemd --with-config-file-scan-dir=/usr/local/php56/lib/php.conf.d --with-curl --with-gd --enable-gd-native-ttf --with-gettext --with-jpeg-dir=/usr/local/lib --with-freetype-dir=/usr/local/lib --with-libxml-dir=/usr/local/lib --with-kerberos --with-openssl --with-mcrypt --with-mhash --with-mysql=mysqlnd --with-mysql-sock=/var/lib/mysql/mysql.sock --with-mysqli=mysqlnd --with-pcre-regex=/usr/local --with-pdo-mysql=mysqlnd --with-pear --with-png-dir=/usr/local/lib --with-xsl --with-zlib --enable-zip --with-iconv=/usr/local --enable-bcmath --enable-calendar --enable-exif --enable-ftp --enable-sockets --enable-soap --enable-mbstring --with-icu-dir=/usr/local/icu --enable-intl CXXFLAGS=-std=c++11 -DU_USING_ICU_NAMESPACE=1]
  --version           [5.6.40]
  --vernum            [50640]

-------------------------------------------------------
inspect /usr/local/php56/lib/php.conf.d

/usr/local/php56/bin/php56 --ini
Configuration File (php.ini) Path: /usr/local/php56/lib
Loaded Configuration File:         /usr/local/php56/lib/php.ini
Scan for additional .ini files in: /usr/local/php56/lib/php.conf.d
Additional .ini files parsed:      /usr/local/php56/lib/php.conf.d/10-directadmin.ini,
/usr/local/php56/lib/php.conf.d/90-custom.ini,
/usr/local/php56/lib/php.conf.d/99-custom.ini

inspect /usr/local/php56/lib/php.conf.d/10-directadmin.ini
extension_dir=/usr/local/php56/lib/php/extensions/no-debug-non-zts-20131226
extension=imagick.so
zend_extension=/usr/local/php56/lib/php/extensions/no-debug-non-zts-20131226/opcache.so
opcache.memory_consumption=192
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.revalidate_freq=30
opcache.enable_cli=0
opcache.validate_permission=1
opcache.use_cwd=1
opcache.revalidate_path=1
opcache.enable_file_override=1


inspect /usr/local/php56/lib/php.conf.d/90-custom.ini
extension=geoip.so
extension=memcache.so

inspect /usr/local/php56/lib/php.conf.d/99-custom.ini
max_input_vars=10000

-------------------------------------------------------
php-config: 7.2.20
config file scan dir: /usr/local/php72/lib/php.conf.d

Usage: /usr/local/php72/bin/php-config [OPTION]
Options:
  --prefix            [/usr/local/php72]
  --includes          [-I/usr/local/php72/include/php -I/usr/local/php72/include/php/main -I/usr/local/php72/include/php/TSRM -I/usr/local/php72/include/php/Zend -I/usr/local/php72/include/php/ext -I/usr/local/php72/include/php/ext/date/lib]
  --ldflags           [ -L/usr/local/lib -L/usr/local/icu/lib]
  --libs              [-lcrypt   -lz -lexslt -lresolv -lcrypt -lsodium -lrt -lstdc++ -liconv -lpng -lz -ljpeg -lwebp -lz -lpcre -lrt -lm -ldl -lnsl  -lsystemd -lxml2 -lz -liconv -lm -ldl -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lssl -lcrypto -lcurl -lxml2 -lz -liconv -lm -ldl -lssl -lcrypto -lfreetype -licui18n -licuuc -licudata -licuio -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lcrypt -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lxslt -lxml2 -lz -liconv -ldl -lm -lssl -lcrypto -lcrypt ]
  --extension-dir     [/usr/local/php72/lib/php/extensions/no-debug-non-zts-20170718]
  --include-dir       [/usr/local/php72/include/php]
  --man-dir           [/usr/local/php72/php/man]
  --php-binary        [/usr/local/php72/bin/php72]
  --php-sapis         [ cli fpm phpdbg cgi]
  --configure-options [--prefix=/usr/local/php72 --program-suffix=72 --enable-fpm --with-fpm-systemd --with-config-file-scan-dir=/usr/local/php72/lib/php.conf.d --with-curl --with-gd --with-gettext --with-jpeg-dir=/usr/local/lib --with-freetype-dir=/usr/local/lib --with-libxml-dir=/usr/local/lib --with-kerberos --with-openssl --with-mhash --with-mysql-sock=/var/lib/mysql/mysql.sock --with-mysqli=mysqlnd --with-pcre-regex=/usr/local --with-pdo-mysql=mysqlnd --with-pear --with-png-dir=/usr/local/lib --with-sodium=/usr/local --with-webp-dir=/usr/local/lib --with-xsl --with-zlib --enable-zip --with-iconv=/usr/local --enable-bcmath --enable-calendar --enable-exif --enable-ftp --enable-sockets --enable-soap --enable-mbstring --with-icu-dir=/usr/local/icu --enable-intl]
  --version           [7.2.20]
  --vernum            [70220]

-------------------------------------------------------
inspect /usr/local/php72/lib/php.conf.d

/usr/local/php72/bin/php72 --ini
Configuration File (php.ini) Path: /usr/local/php72/lib
Loaded Configuration File:         /usr/local/php72/lib/php.ini
Scan for additional .ini files in: /usr/local/php72/lib/php.conf.d
Additional .ini files parsed:      /usr/local/php72/lib/php.conf.d/10-directadmin.ini,
/usr/local/php72/lib/php.conf.d/90-custom.ini,
/usr/local/php72/lib/php.conf.d/99-custom.ini

inspect /usr/local/php72/lib/php.conf.d/10-directadmin.ini
extension_dir=/usr/local/php72/lib/php/extensions/no-debug-non-zts-20170718
extension=imagick.so
zend_extension=/usr/local/php72/lib/php/extensions/no-debug-non-zts-20170718/opcache.so
opcache.memory_consumption=192
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.revalidate_freq=30
opcache.enable_cli=0
opcache.validate_permission=1
opcache.use_cwd=1
opcache.revalidate_path=1
opcache.enable_file_override=1


inspect /usr/local/php72/lib/php.conf.d/90-custom.ini
extension=redis.so
extension=memcached.so
extension=geoip.so

inspect /usr/local/php72/lib/php.conf.d/99-custom.ini
max_input_vars=10000

-------------------------------------------------------
php-config: 7.3.7
config file scan dir: /usr/local/php73/lib/php.conf.d

Usage: /usr/local/php73/bin/php-config [OPTION]
Options:
  --prefix            [/usr/local/php73]
  --includes          [-I/usr/local/php73/include/php -I/usr/local/php73/include/php/main -I/usr/local/php73/include/php/TSRM -I/usr/local/php73/include/php/Zend -I/usr/local/php73/include/php/ext -I/usr/local/php73/include/php/ext/date/lib]
  --ldflags           [ -L/usr/local/lib -L/usr/local/icu/lib]
  --libs              [-lcrypt   -lz -lexslt -lresolv -lcrypt -lsodium -lrt -lstdc++ -liconv -lpng -lz -ljpeg -lwebp -lz -lrt -lm -ldl -lnsl  -lsystemd -lxml2 -lz -liconv -lm -ldl -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lssl -lcrypto -lpcre2-8 -lcurl -lxml2 -lz -liconv -lm -ldl -lssl -lcrypto -lfreetype -licui18n -licuuc -licudata -licuio -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lcrypt -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lxslt -lxml2 -lz -liconv -ldl -lm -lssl -lcrypto -lcrypt ]
  --extension-dir     [/usr/local/php73/lib/php/extensions/no-debug-non-zts-20180731]
  --include-dir       [/usr/local/php73/include/php]
  --man-dir           [/usr/local/php73/php/man]
  --php-binary        [/usr/local/php73/bin/php73]
  --php-sapis         [ cli fpm phpdbg cgi]
  --configure-options [--prefix=/usr/local/php73 --program-suffix=73 --enable-fpm --with-fpm-systemd --with-config-file-scan-dir=/usr/local/php73/lib/php.conf.d --with-curl --with-gd --with-gettext --with-jpeg-dir=/usr/local/lib --with-freetype-dir=/usr/local/lib --with-libxml-dir=/usr/local/lib --with-kerberos --with-openssl --with-mhash --with-mysql-sock=/var/lib/mysql/mysql.sock --with-mysqli=mysqlnd --with-pcre-regex=/usr/local --with-pdo-mysql=mysqlnd --with-pear --with-png-dir=/usr/local/lib --with-sodium=/usr/local --with-webp-dir=/usr/local/lib --with-xsl --with-zlib --enable-zip --without-libzip --with-iconv=/usr/local --enable-bcmath --enable-calendar --enable-exif --enable-ftp --enable-sockets --enable-soap --enable-mbstring --with-icu-dir=/usr/local/icu --enable-intl]
  --version           [7.3.7]
  --vernum            [70307]

-------------------------------------------------------
inspect /usr/local/php73/lib/php.conf.d

/usr/local/php73/bin/php73 --ini
Configuration File (php.ini) Path: /usr/local/php73/lib
Loaded Configuration File:         /usr/local/php73/lib/php.ini
Scan for additional .ini files in: /usr/local/php73/lib/php.conf.d
Additional .ini files parsed:      /usr/local/php73/lib/php.conf.d/10-directadmin.ini,
/usr/local/php73/lib/php.conf.d/50-webapps.ini,
/usr/local/php73/lib/php.conf.d/90-custom.ini,
/usr/local/php73/lib/php.conf.d/99-custom.ini

inspect /usr/local/php73/lib/php.conf.d/10-directadmin.ini
extension_dir=/usr/local/php73/lib/php/extensions/no-debug-non-zts-20180731
extension=imagick.so
zend_extension=/usr/local/php73/lib/php/extensions/no-debug-non-zts-20180731/opcache.so
opcache.memory_consumption=192
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.revalidate_freq=30
opcache.enable_cli=0
opcache.validate_permission=1
opcache.use_cwd=1
opcache.revalidate_path=1
opcache.enable_file_override=1


inspect /usr/local/php73/lib/php.conf.d/50-webapps.ini
[PATH=/var/www/html]
session.save_path=/var/www/tmp
upload_tmp_dir=/var/www/tmp
disable_functions=exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname

inspect /usr/local/php73/lib/php.conf.d/90-custom.ini
extension=redis.so
extension=memcached.so
extension=geoip.so

inspect /usr/local/php73/lib/php.conf.d/99-custom.ini
max_input_vars=10000
And finally running getphpconfig command without any option parameters just reports each php-fpm versions information
Code:
getphpconfig 
-------------------------------------------------------
php-config: 5.6.40
config file scan dir: /usr/local/php56/lib/php.conf.d

Usage: /usr/local/php56/bin/php-config [OPTION]
Options:
  --prefix            [/usr/local/php56]
  --includes          [-I/usr/local/php56/include/php -I/usr/local/php56/include/php/main -I/usr/local/php56/include/php/TSRM -I/usr/local/php56/include/php/Zend -I/usr/local/php56/include/php/ext -I/usr/local/php56/include/php/ext/date/lib]
  --ldflags           [ -L/usr/local/lib -L/usr/local/icu/lib]
  --libs              [-lcrypt   -lz -lexslt -lresolv -lcrypt -lrt -lmcrypt -lltdl -lstdc++ -liconv -lpng -lz -ljpeg -lcurl -lz -lpcre -lrt -lm -ldl -lnsl  -lsystemd -lxml2 -lz -liconv -lm -ldl -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lssl -lcrypto -lcurl -lxml2 -lz -liconv -lm -ldl -lssl -lcrypto -lfreetype -licui18n -licuuc -licudata -licuio -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lcrypt -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lxslt -lxml2 -lz -liconv -ldl -lm -lssl -lcrypto -lcrypt ]
  --extension-dir     [/usr/local/php56/lib/php/extensions/no-debug-non-zts-20131226]
  --include-dir       [/usr/local/php56/include/php]
  --man-dir           [/usr/local/php56/php/man]
  --php-binary        [/usr/local/php56/bin/php56]
  --php-sapis         [ cli fpm cgi]
  --configure-options [--prefix=/usr/local/php56 --program-suffix=56 --enable-fpm --with-fpm-systemd --with-config-file-scan-dir=/usr/local/php56/lib/php.conf.d --with-curl --with-gd --enable-gd-native-ttf --with-gettext --with-jpeg-dir=/usr/local/lib --with-freetype-dir=/usr/local/lib --with-libxml-dir=/usr/local/lib --with-kerberos --with-openssl --with-mcrypt --with-mhash --with-mysql=mysqlnd --with-mysql-sock=/var/lib/mysql/mysql.sock --with-mysqli=mysqlnd --with-pcre-regex=/usr/local --with-pdo-mysql=mysqlnd --with-pear --with-png-dir=/usr/local/lib --with-xsl --with-zlib --enable-zip --with-iconv=/usr/local --enable-bcmath --enable-calendar --enable-exif --enable-ftp --enable-sockets --enable-soap --enable-mbstring --with-icu-dir=/usr/local/icu --enable-intl CXXFLAGS=-std=c++11 -DU_USING_ICU_NAMESPACE=1]
  --version           [5.6.40]
  --vernum            [50640]

-------------------------------------------------------
php-config: 7.2.20
config file scan dir: /usr/local/php72/lib/php.conf.d

Usage: /usr/local/php72/bin/php-config [OPTION]
Options:
  --prefix            [/usr/local/php72]
  --includes          [-I/usr/local/php72/include/php -I/usr/local/php72/include/php/main -I/usr/local/php72/include/php/TSRM -I/usr/local/php72/include/php/Zend -I/usr/local/php72/include/php/ext -I/usr/local/php72/include/php/ext/date/lib]
  --ldflags           [ -L/usr/local/lib -L/usr/local/icu/lib]
  --libs              [-lcrypt   -lz -lexslt -lresolv -lcrypt -lsodium -lrt -lstdc++ -liconv -lpng -lz -ljpeg -lwebp -lz -lpcre -lrt -lm -ldl -lnsl  -lsystemd -lxml2 -lz -liconv -lm -ldl -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lssl -lcrypto -lcurl -lxml2 -lz -liconv -lm -ldl -lssl -lcrypto -lfreetype -licui18n -licuuc -licudata -licuio -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lcrypt -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lxslt -lxml2 -lz -liconv -ldl -lm -lssl -lcrypto -lcrypt ]
  --extension-dir     [/usr/local/php72/lib/php/extensions/no-debug-non-zts-20170718]
  --include-dir       [/usr/local/php72/include/php]
  --man-dir           [/usr/local/php72/php/man]
  --php-binary        [/usr/local/php72/bin/php72]
  --php-sapis         [ cli fpm phpdbg cgi]
  --configure-options [--prefix=/usr/local/php72 --program-suffix=72 --enable-fpm --with-fpm-systemd --with-config-file-scan-dir=/usr/local/php72/lib/php.conf.d --with-curl --with-gd --with-gettext --with-jpeg-dir=/usr/local/lib --with-freetype-dir=/usr/local/lib --with-libxml-dir=/usr/local/lib --with-kerberos --with-openssl --with-mhash --with-mysql-sock=/var/lib/mysql/mysql.sock --with-mysqli=mysqlnd --with-pcre-regex=/usr/local --with-pdo-mysql=mysqlnd --with-pear --with-png-dir=/usr/local/lib --with-sodium=/usr/local --with-webp-dir=/usr/local/lib --with-xsl --with-zlib --enable-zip --with-iconv=/usr/local --enable-bcmath --enable-calendar --enable-exif --enable-ftp --enable-sockets --enable-soap --enable-mbstring --with-icu-dir=/usr/local/icu --enable-intl]
  --version           [7.2.20]
  --vernum            [70220]

-------------------------------------------------------
php-config: 7.3.7
config file scan dir: /usr/local/php73/lib/php.conf.d

Usage: /usr/local/php73/bin/php-config [OPTION]
Options:
  --prefix            [/usr/local/php73]
  --includes          [-I/usr/local/php73/include/php -I/usr/local/php73/include/php/main -I/usr/local/php73/include/php/TSRM -I/usr/local/php73/include/php/Zend -I/usr/local/php73/include/php/ext -I/usr/local/php73/include/php/ext/date/lib]
  --ldflags           [ -L/usr/local/lib -L/usr/local/icu/lib]
  --libs              [-lcrypt   -lz -lexslt -lresolv -lcrypt -lsodium -lrt -lstdc++ -liconv -lpng -lz -ljpeg -lwebp -lz -lrt -lm -ldl -lnsl  -lsystemd -lxml2 -lz -liconv -lm -ldl -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lssl -lcrypto -lpcre2-8 -lcurl -lxml2 -lz -liconv -lm -ldl -lssl -lcrypto -lfreetype -licui18n -licuuc -licudata -licuio -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lcrypt -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lxslt -lxml2 -lz -liconv -ldl -lm -lssl -lcrypto -lcrypt ]
  --extension-dir     [/usr/local/php73/lib/php/extensions/no-debug-non-zts-20180731]
  --include-dir       [/usr/local/php73/include/php]
  --man-dir           [/usr/local/php73/php/man]
  --php-binary        [/usr/local/php73/bin/php73]
  --php-sapis         [ cli fpm phpdbg cgi]
  --configure-options [--prefix=/usr/local/php73 --program-suffix=73 --enable-fpm --with-fpm-systemd --with-config-file-scan-dir=/usr/local/php73/lib/php.conf.d --with-curl --with-gd --with-gettext --with-jpeg-dir=/usr/local/lib --with-freetype-dir=/usr/local/lib --with-libxml-dir=/usr/local/lib --with-kerberos --with-openssl --with-mhash --with-mysql-sock=/var/lib/mysql/mysql.sock --with-mysqli=mysqlnd --with-pcre-regex=/usr/local --with-pdo-mysql=mysqlnd --with-pear --with-png-dir=/usr/local/lib --with-sodium=/usr/local --with-webp-dir=/usr/local/lib --with-xsl --with-zlib --enable-zip --without-libzip --with-iconv=/usr/local --enable-bcmath --enable-calendar --enable-exif --enable-ftp --enable-sockets --enable-soap --enable-mbstring --with-icu-dir=/usr/local/icu --enable-intl]
  --version           [7.3.7]
  --vernum            [70307]
 
DirectAdmin just uses 10-directadmin.ini and 50-webapps.ini in php.conf.d, these would be overwrriten, any other files there - not, and that's really a good place to do php.ini changes :)
 
thanks @smtalk for the clarification :)

will push my customisations into lib/php.conf.d/99-custom.ini :D
 
thanks @smtalk for the clarification :)

will push my customisations into lib/php.conf.d/99-custom.ini :D

If you're going to 'overwrite' the file, I'd suggest using something customers wouldn't 'think about' when creating their own files :) For example - 2000-phpconfig.ini (this is just an idea, you might find a better name :D).
 
If you're going to 'overwrite' the file, I'd suggest using something customers wouldn't 'think about' when creating their own files :) For example - 2000-phpconfig.ini (this is just an idea, you might find a better name :D).

Yeah only plan to override DirectAdmin defaults but still allow end users/customers to override my custom defaults. Well that's the plan :)

raise zend opcache memory allocation
Code:
getphpconfig set opcache.memory_consumption=256
Code:
getphpconfig set opcache.memory_consumption=256

-------------------------------------------------------
set opcache.memory_consumption=256
updating /usr/local/php56/lib/php.conf.d/99-custom.ini

Redirecting to /bin/systemctl restart php-fpm56.service

inspecting set php option: opcache.memory_consumption
opcache.memory_consumption => 256 => 256


-------------------------------------------------------
set opcache.memory_consumption=256
updating /usr/local/php72/lib/php.conf.d/99-custom.ini

Redirecting to /bin/systemctl restart php-fpm72.service

inspecting set php option: opcache.memory_consumption
opcache.memory_consumption => 256 => 256


-------------------------------------------------------
set opcache.memory_consumption=256
updating /usr/local/php73/lib/php.conf.d/99-custom.ini

Redirecting to /bin/systemctl restart php-fpm73.service

inspecting set php option: opcache.memory_consumption
opcache.memory_consumption => 256 => 256
verify changed zend opcache settings
Code:
getphpconfig info opcache                                 

/usr/local/php56/bin/php56 --ri 'zend opcache'

Zend OPcache

Opcode Caching => Disabled
Optimization => Disabled
Startup Failed => Opcode Caching is disabled for CLI

Directive => Local Value => Master Value
opcache.enable => On => On
opcache.use_cwd => On => On
opcache.validate_timestamps => On => On
opcache.validate_permission => On => On
opcache.validate_root => Off => Off
opcache.inherited_hack => On => On
opcache.dups_fix => Off => Off
opcache.revalidate_path => On => On
opcache.log_verbosity_level => 1 => 1
opcache.memory_consumption => 256 => 256
opcache.interned_strings_buffer => 8 => 8
opcache.max_accelerated_files => 10000 => 10000
opcache.max_wasted_percentage => 5 => 5
opcache.consistency_checks => 0 => 0
opcache.force_restart_timeout => 180 => 180
opcache.revalidate_freq => 30 => 30
opcache.file_update_protection => 2 => 2
opcache.preferred_memory_model => no value => no value
opcache.blacklist_filename => no value => no value
opcache.max_file_size => 0 => 0
opcache.protect_memory => 0 => 0
opcache.save_comments => 1 => 1
opcache.load_comments => 1 => 1
opcache.fast_shutdown => 0 => 0
opcache.optimization_level => 0x7FFFBFFF => 0x7FFFBFFF
opcache.enable_file_override => On => On
opcache.enable_cli => Off => Off
opcache.error_log => no value => no value
opcache.restrict_api => no value => no value


/usr/local/php72/bin/php72 --ri 'zend opcache'

Zend OPcache

Opcode Caching => Disabled
Optimization => Disabled
SHM Cache => Enabled
File Cache => Disabled
Startup Failed => Opcode Caching is disabled for CLI

Directive => Local Value => Master Value
opcache.enable => On => On
opcache.use_cwd => On => On
opcache.validate_timestamps => On => On
opcache.validate_permission => On => On
opcache.validate_root => Off => Off
opcache.inherited_hack => On => On
opcache.dups_fix => Off => Off
opcache.revalidate_path => On => On
opcache.log_verbosity_level => 1 => 1
opcache.memory_consumption => 256 => 256
opcache.interned_strings_buffer => 8 => 8
opcache.max_accelerated_files => 10000 => 10000
opcache.max_wasted_percentage => 5 => 5
opcache.consistency_checks => 0 => 0
opcache.force_restart_timeout => 180 => 180
opcache.revalidate_freq => 30 => 30
opcache.file_update_protection => 2 => 2
opcache.preferred_memory_model => no value => no value
opcache.blacklist_filename => no value => no value
opcache.max_file_size => 0 => 0
opcache.protect_memory => 0 => 0
opcache.save_comments => 1 => 1
opcache.optimization_level => 0x7FFFBFFF => 0x7FFFBFFF
opcache.opt_debug_level => 0 => 0
opcache.enable_file_override => On => On
opcache.enable_cli => Off => Off
opcache.error_log => no value => no value
opcache.restrict_api => no value => no value
opcache.lockfile_path => /tmp => /tmp
opcache.file_cache => no value => no value
opcache.file_cache_only => 0 => 0
opcache.file_cache_consistency_checks => 1 => 1
opcache.huge_code_pages => Off => Off


/usr/local/php73/bin/php73 --ri 'zend opcache'

Zend OPcache

Opcode Caching => Disabled
Optimization => Disabled
SHM Cache => Enabled
File Cache => Disabled
Startup Failed => Opcode Caching is disabled for CLI

Directive => Local Value => Master Value
opcache.enable => On => On
opcache.use_cwd => On => On
opcache.validate_timestamps => On => On
opcache.validate_permission => On => On
opcache.validate_root => Off => Off
opcache.dups_fix => Off => Off
opcache.revalidate_path => On => On
opcache.log_verbosity_level => 1 => 1
opcache.memory_consumption => 256 => 256
opcache.interned_strings_buffer => 8 => 8
opcache.max_accelerated_files => 10000 => 10000
opcache.max_wasted_percentage => 5 => 5
opcache.consistency_checks => 0 => 0
opcache.force_restart_timeout => 180 => 180
opcache.revalidate_freq => 30 => 30
opcache.file_update_protection => 2 => 2
opcache.preferred_memory_model => no value => no value
opcache.blacklist_filename => no value => no value
opcache.max_file_size => 0 => 0
opcache.protect_memory => 0 => 0
opcache.save_comments => 1 => 1
opcache.optimization_level => 0x7FFEBFFF => 0x7FFEBFFF
opcache.opt_debug_level => 0 => 0
opcache.enable_file_override => On => On
opcache.enable_cli => Off => Off
opcache.error_log => no value => no value
opcache.restrict_api => no value => no value
opcache.lockfile_path => /tmp => /tmp
opcache.file_cache => no value => no value
opcache.file_cache_only => 0 => 0
opcache.file_cache_consistency_checks => 1 => 1
opcache.huge_code_pages => Off => Off
 
Last edited:
Hi, @smtalk @eva2000

If I would like to make 99-custom.ini as a custom template for each php-fpm version I have (4 versions), where is the custom path that I have to place the file in?

Thanks

*** Just updated, I found the path already. Example like /usr/local/php74/lib/php.conf.d/99-custom.ini
 
Last edited:
I wrote my own php config command script which
  1. inspect all php-fpm versions configuration settings
  2. inspect all php-fpm versions *.ini configuration paths and settings
  3. set and add custom php configuration options into own override 99-custom.ini settings file for each php-fpm version installed and restart respective services and then inspect the new php set value
Hey mate, do you have any plans to share your wonderful command script? 😇
 
Hi, @smtalk @eva2000

If I would like to make 99-custom.ini as a custom template for each php-fpm version I have (4 versions), where is the custom path that I have to place the file in?

Thanks
+1
how to place a 99-custom.ini to be copied into php.conf.d when a new php mayor version compilation arrives (8.0, 8.1, etc)?
 
+1
how to place a 99-custom.ini to be copied into php.conf.d when a new php mayor version compilation arrives (8.0, 8.1, etc)?
just copy or create new one. example like /usr/local/php80/lib/php.conf.d/99-custom.ini
 
Back
Top