Symptoms
When installing WordPress via Plesk WP Toolkit or using native WordPress installer for a domain that uses PHP version 8.0 or later with "mail" function disabled, the installation fails with the message:
PHP Fatal error: Uncaught Error: Call to undefined function PHPMailerPHPMailermail() in /var/www/vhosts/plesksupport.test/httpdocs/wordpress/wp-includes/PHPMailer/PHPMailer.php:874
Stack trace:
#0 /var/www/vhosts/plesksupport.test/httpdocs/wordpress/wp-includes/PHPMailer/PHPMailer.php(1923): PHPMailerPHPMailerPHPMailer->mailPassthru()
Cause
In PHP 8, disabled functions are treated as non-existent functions. Calling a disabled function will produce fatal error:
Resolution
Solution I: disable notification emails
-
Go to WP Toolkit > Settings.
-
Disable the setting Allow WordPress sites to send notification emails after installation.
Solution II: enable "mail" function
-
Remove "mail" function from disable_functions at Domains > example.com > PHP Settings
or change PHP version to 7.4 (if installed).