How to disable PHP functions in WordPress?

Create a php.ini file for your WP instance and add the disable_functions directive to it. Then, start the PHP server with -c option, such as php -S 127.0.0.1:8001 -c /path/to/php.ini -f /var/www/html/wordpress/.