How to customize disable_functions in directadmin

The directive "disable_functions" allows to disable certain functions. It takes on a comma-delimited list of function names.

DirectAdmin uses the directive for security purposes, and here is a way how to customize it. We need to create a file /usr/local/directadmin/custombuild/custom/php_disable_functions with our own list of functions.

Let's say we want to allow exec, proc_open server-wide in DirectAdmin in PHP.

cd /usr/local/directadmin/custombuild
touch custom/php_disable_functions

Here is a default sample list

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
cd /usr/local/directadmin/custombuild
echo "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" > custom/php_disable_functions
./build set secure_php yes
./build secure_php
php -i | grep ^disable_functions

Please rate this article to help us improve our Knowledge Base.

0 0