PHP Nette - Nette\Mail\SmtpException #13 Permission denied
Dobrý den, na VM stroji s Linux CentOS + Apache 2 + PHP7, dostávám při použití modelu pro odesílání emailu z PHP Nette chybu Nette\Mail\SmtpException #13 Permission denied. Nevíte co to může způsobovat? Díky
Dobrý den,
to způsobuje SELinux, nastavte vyjímku:
Nette\Mail\SmtpException #13
Permission denied search►
/var/www/devils/app/model/Emaily.php:55 source Nette\Mail\SmtpMailer->send(arguments)
45: //latte sablona emailu
46: $sablona = __DIR__ . '/../FrontModule/presenters/templates/emaily/' . $values['sablona'] . '.latte';
47:
48: //sestaveni zpravy
49: $mail = new Message;
50: $mail->setFrom($default_mail_from->n_hodnota, $default_name_app->n_hodnota)
51: ->addTo($values['to'])
52: ->setSubject($values['predmet'])
53: ->setHtmlBody($latte->renderToString($sablona, $values));
54:
55: $this->mailer->send($mail);
56: /*
57: //odeslani zpravy
58: try {
59:
Last muted error
Warning: stream_socket_client(): unable to connect to server.cz:587 (Permission denied)
.../devils/vendor/nette/mail/src/Mail/SmtpMailer.php:125
115:
116:
117: /**
118: * Connects and authenticates to SMTP server.
119: * @return void
120: */
121: protected function connect()
122: {
123: $this->connection = @stream_socket_client(// @ is escalated to exception
124: ($this->secure === 'ssl' ? 'ssl://' : '') . $this->host . ':' . $this->port,
125: $errno, $error, $this->timeout, STREAM_CLIENT_CONNECT, $this->context
126: );
127: if (!$this->connection) {
128: throw new SmtpException($error, $errno);
129: }
ODPOVĚĎ
Dobrý den,
to způsobuje SELinux, nastavte vyjímku:
setsebool -P httpd_can_network_connect 1