How do you disable email sent from PHP with PHP-FPM?
We have a server that wants to remove all email being sent from it. I disabled exim and IMAP but I can't find how to disable PHP email. I've scoured this forum for 20 minutes and give up lol.
Can someone post a cheat code of what file to edit and what to add to disable all PHP email when using PHP-FPM please?
I assume it's something to do with the file default_accounts_to_fpm
Maybe add this there?: disable_mail
-
Hello, You'd just need to follow the instructions for modifying .ini values here: How to Manage Your php.ini Directives with PHP FPM | cPanel & WHM Documentation 0 -
I read that many times and it does not say anything about removing mail and the tutorial is confusing. Where is the examples? I got as far as: - /var/cpanel/ApachePHPFPM directory if it does not already exist.
- Create the /system_pool_defaults.yaml file.
0 -
I'm sorry I thought you understood how to disable PHP mail but just needed the instructions to do so with php-fpm. You need to add the following: This uses: disable_functions =
and the value for PHP mail is just "mail" so you'd just want to add mail to the appropriate file. The default for this with php-fpm as listed in the guide you linked looks like the following:php_admin_value_disable_functions: exec,passthru,shell_exec,system
You'd change it to be:php_admin_value_disable_functions: exec,mail,passthru,shell_exec,system
Then follow the instructions on changing this either globally or per domain as listed in the documentation I originally linked0 -
I should of mentioned I was past that, sorry. This is perfect, thank you! 0 -
So the file should like this right: disable_functions = php_admin_value_disable_functions: exec,mail,passthru,shell_exec,system 0 -
in the default php.ini it looks like (only added this so you knew which section in the normal php.ini file it was) : disable_functions =
If you want to change that or all of the PHP versions php.ini files in case you decide to disable php-fpm you'll make it look like:disable_functions = mail
When modifying for php-fpm it looks like:php_admin_value_disable_functions: exec,passthru,shell_exec,system
If you want to disable mail when running php-fpm you'll change the appropriate file to look like:php_admin_value_disable_functions: exec,mail,passthru,shell_exec,system
0 -
This is for a server that uses PHPFPM So I add to the file: /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml php_admin_value_disable_functions: exec,mail,passthru,shell_exec,system
Then reboot PHPFPM Correct?0 -
A bit more than that. You'll need to do the following (as noted in the documentation for making modifications both globally and per domain) Rebuild the PHP-FPM configuration usr/local/cpanel/scripts/php_fpm_config --rebuild
Restart PHP-FPM and Apache:/usr/local/cpanel/scripts/restartsrv_apache_php_fpm /usr/local/cpanel/scripts/restartsrv_httpd
0
Please sign in to leave a comment.
Comments
8 comments