Disabling PHP mail on your hosting account

Simply place a php.ini file in the public_html folder of your website, or any folder where you want to apply a different configuration, with the following content:

disable_functions=apache_child_terminate, apache_setenv, define_syslog_variables, escapeshellarg, escapeshellcmd, eval, exec, fp, fput, ftp_connect, ftp_exec, ftp_get, ftp_login, ftp_nb_fput, ftp_put, ftp_raw, ftp_rawlist, highlight_file, ini_alter, ini_get_all, ini_restore, inject_code, mysql_pconnect, openlog, passthru, phpAds_remoteInfo, phpAds_XmlRpc, phpAds_xmlrpcDecode, phpAds_xmlrpcEncode, popen, posix_getpwuid, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid, posix_setuid, posix_uname, proc_close, proc_get_status, proc_nice, proc_open, proc_terminate, shell_exec, syslog, system, xmlrpc_entity_decode, mail

This line contains all the recommended functions that should be disabled for security reasons as well as PHP mail.

The php.ini settings will only apply to the folder where the php.ini file is placed. If you want to apply it recursively to any child directories, then add the following line to a .htaccess file within the same directory:

suPHP_ConfigPath /home/username/public_html

(where "username" should be replaced with your cPanel username)

Have more questions? Submit a request

Comments