PHP contains a lot of different functions that are used in various scripts however some of these functions are deemed insecure and could leave your dedicated server vulnerable to attacks from malicious users. Luckily PHP includes an option to disable some of it’s functions so it is possible to disable some of the dangerous functions that should never be used in a standard public facing website.
- Find the current PHP configuration file
php -i |grep php.ini Configuration File (php.ini) Path /usr/lib Loaded Configuration File /usr/local/lib/php.ini
- Edit the configuration file
nano /usr/local/lib/php.ini
- Search for “disable_functions” and add in the dangerous functions
disable_functions = "symlink,shell_exec,exec,system,popen,proc_close"
- Restart apache
service httpd restart
If you now attempt to use one of the functions that have been disabled you should get a PHP error. Please note that this function list is not complete and you should add in the functions that you wish to disable based on your scripts and what they require to operate properly.