skip to Main Content

After a recent automatic update to linux components (CentOS v7 with PLesk 17.8.11) my web (php) applications are no longer enabled to do outbound connections.
Both “curl” requests and PHPMailer fail; curl is returning http code 0 with no content, while PHPMailer says “SMTP Connect() failed”.
The same statements/programs work perfectly when run from terminal (root user). In other words, if I write a trivial program executing “curl http://www.example.com” and run it from terminal, it works; if I call it from a browser, it does not work.
The same is true for any program using PHPMailer to send a mail.
SELinux is disabled, so it does not depends on the httpd_can_network_connect SELinux boolean.

Any idea?

2

Answers


  1. Chosen as BEST ANSWER

    I found a solution, but I did not really understood what the real reason was. By default, my CentOS+Plesk server has SELinux disabled: I changed it to "enabled" with SELINUX=permissive, then I changed two SELinux booleans:

    setsebool -P httpd_can_network_connect on
    setsebool -P httpd_can_sendmail on
    

    Even if SELinux is in warning-only mode, settings those two booleans on made the trick.


  2. Most likely, affected domains are using system PHP, which was updated recently. Correct me if I am wrong.

    What would explain broken PHP functionality, because during the update of system PHP package, Apache restart is not triggered by Plesk.

    Simply restart Apache in Tools & Settings > Service Management or by using systemctl restart httpd. If the issue still persist after that, try to switch to any of Plesk PHP versions.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search