The LNMP environment doesn’t come with the sendmail component installed. You simply need to start the sendmail service and configure the path in php.ini to get email sending working properly.
1. Install the sendmail component
yum install sendmail
2. Restart the php-fpm process
/etc/init.d/php-fpm restart
If the restart fails or gets stuck, I recommend closing the terminal, logging back in, and restarting LNMP directly with the following command:
/root/lnmp restart
3. Verify sendmail is running properly
/etc/init.d/sendmail status
If both sendmail and sm-client show as running, the service has started successfully. If both show as stopped, you can try these commands:
/etc/init.d/sendmail start (start sendmail)
/etc/init.d/sendmail stop (stop sendmail)
/etc/init.d/sendmail restart (restart sendmail)
4. Configure php.ini with the sendmail absolute path
Use the following command to open and edit php.ini. Alternatively, you can use FTP to navigate to the directory, download the php.ini file, and edit it locally — same result.
vi /usr/local/php/etc/php.ini
Type ?sendmail_path to search and locate the following line:
;sendmail_path =
Press i to enter edit mode and change that line to:
sendmail_path = /usr/sbin/sendmail -t -i
Press Esc to exit edit mode, then type :wq to save and quit.
Finally, restart LNMP once more and you’re done. Test it — emails should now send successfully.