Hi Guys,
I had a ticket today with the same question so figured I'd follow it up here.
As zEitEr mentioned, disable_functions cannot be listed the php.ini if they're ever to be used later on, else (I'm guessing) php won't load them into memory or ever allow their use later on. The solution is to do the inverse, enable them at load, but disable them later on.
This guide is how you'd just "defer" when a function is disabled, to be done in the per-user php-fpm config, but system globally, so you don't have to do it for each user. With this method, you can just override the disable_functions list on a per-user basis, later on via the GUI.
- Don't block functions wih the php.ini:
Code:
da build set secure_php no
da build php_ini
- Create 2 system global template token configs with the following code:
/usr/local/directadmin/data/templates/custom/php-fpm.conf.custom1
Code:
|?DF=php_admin_value[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|
/usr/local/directadmin/data/templates/custom/php-fpm.conf.custom2
This will set the listed disable_functions list to all Users on the system after their data/users/fred/php/php-fpm83.conf is rewritten:
- Disable proc_open for any Users that needs it by going to:
Admin Level » Custom Httpd Config » domain.com - php-fpm 8.3
and in the "php-fpm Global |CUSTOM 1|" token area, add the line to override the first, without proc_open, eg:
Code:
|?DF=php_admin_value[disable_functions] = exec,system,passthru,shell_exec,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname|
and hit save. View the resulting php-fpm config, and the DF variable in user global CUSTOM 1 should have overridden the system global CUSTOM 1.
You'll need to restart php-fpm83 after making the changes.
Note, I'm calling "System Global" the files saved in the data/templates/custom directory, and the "User Global" the value in the GUI which refers to all php versions of that User. Apologies for the confusion double use of the term "Global"
John