PHPMailer SMTP -> ERROR: Failed to connect to server: Permission denied (13) fix
This is an error produced by PHPMailer. On CentOS, Red Hat and similar distributions, you will need to set a few things for PHPMailer to send emails.
First, try to out put the settings you currently have:
$ getsebool httpd_can_sendmail
httpd_can_sendmail --> off
$ getsebool httpd_can_network_connect
httpd_can_network_connect --> off
If you get something similar, you should set these settings on.
$ setsebool -P httpd_can_sendmail 1
$ setsebool -P httpd_can_network_connect 1
If you get error messages like:
Cannot set persistent booleans without managed policy.
Could not change policy booleans
You may have the need to run these commands as root and you may need to sudo.
$ sudo setsebool -P httpd_can_sendmail 1
$ sudo setsebool -P httpd_can_network_connect 1
Now, try sending emails using your script!
No comments:
Post a Comment