• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Disable function mail()

ErwanG

Regular Pleskian
Hello,

I want to disable mail fonction for one of my customer.
I've put "disabled_functions = mail" in the php.ini from the customer in the panel and i've reload Apache.

It doesn't work.

Thanks for your help.

Config :
Plesk 11.0.9 - PHP 5.3
 
disabled_functions is part of safe mode. Make sure that you have enabled this mode.
 
You could do that from /etc/php.ini but that would affect the customer. Also you could try this out:

Adding php extension flags in

/var/www/vhosts/domain.com/conf/vhost.conf

E.g

<Directory /var/www/vhosts/domain.com/httpdocs>
php_admin_value open_basedir none
php_admin_value safe_mode 0
php_admin_value display_errors 0
php_admin_value file_uploads 1
php_admin_value allow_url_fopen 1
php_admin_value output_buffering 1
php_admin_value memory_limit 64M
</Directory>

The finely

/usr/local/psa/admin/sbin/httpdmng --reconfigure-domain domain.com
 
You can also disable function e-mail in PHP settings within Plesk itself, just go to Websites & Domains, click on domain name, switch to PHP Settings tab, scroll to the end of page and type function "disable_functions = mail" in the textbox (without quotations).

If you're doing that make sure your subscription is locked because of possible new sync to the hosting plan assigned tto this subscription (if subscription is not locked, your function "disable_functions = mail" will disapear and you will have to type it again and again). Your chooise.
 
disable_functions not working

I am trying to configure a hosting plan with disable_functions however after I do a sync, or make a change to the domain, the functions do not get populated in the domains <domain>/etc/php.ini file.

Can someone please help me understand what I am doing wrong and how I make sure these changes get applied to the domains?

Here is what i have:

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, openlog, passthru, php_uname, 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


then in the domain to apply this change I make a small modification and click ok. I see the domain go down briefly as apache is restarted, but the disable_functions do not get applied.

I am using php 5.3 (php_safe mode is deprecated).
According to the manual:
>>
This directive allows you to disable certain functions for security reasons. It takes on a comma-delimited list of function names. disable_functions is not affected by Safe Mode.

Only internal functions can be disabled using this directive. User-defined functions are unaffected.

This directive must be set in php.ini For example, you cannot set this in httpd.conf.
<<

Any assistance is greatly appreciated.
 
Last edited:
You have an answer in your question: "This directive must be set in php.ini For example, you cannot set this in httpd.conf."

Also you can check the manual http://php.net/manual/en/ini.core.php See "Changeable" column. Directive disable_functions can be changed only via php.ini. This means that you should either modify the global php.ini config or use CGI/FastCGI PHP for particular domain.
 
Back
Top