Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

dan3460's avatar

Unable to find socket transport starttls

I'm testing a new mail server provider which requires a smtp connection with STARTTLS. Is showing me the following message:

[Unable to find the socket transport "starttls" - did you forget to enable it when you configured PHP? #32686]

I fund in php.ini php_openssl which i un-commented but did not solved the problem and when taking the server up or down gave an error saying that could not find php_openssl.dll.

Also reading on the web seem to indicate that un-commenting php_openssl only works on windows. Does anyone knows how to solve this issue?

0 likes
15 replies
Snapey's avatar

You have to install the extension, not just uncomment it.

What OS is it?

Cronix's avatar

php_openssl.dll. Not sure why that would be in your php.ini. dll are windows extensions. Try changing it in your php.ini to php_openssl.so.

Also look for the directory that the extensions are installed in. Is anything php_openssl.* in there?

dan3460's avatar

Found the directory where the extensions are stored: /usr/lib/php/20160303. There is a bunch of .so files but php_openssl.so is not there.

Also i run : $ echo '' | php 2>&1 |grep -i ssl and i get this:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/20160303/php_openssl.so' - /usr/lib/php/20160303/php_openssl.so: cannot open shared object file: No such file or directory in Unknown on line 0
Registered Stream Socket Transports => tcp, udp, unix, udg, ssl, tls, tlsv1.0, tlsv1.1, tlsv1.2
core SSL => supported
extended SSL => supported
openssl
OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 1.0.2g  1 Mar 2016
OpenSSL Header Version => OpenSSL 1.0.2g  1 Mar 2016
Openssl default config => /usr/lib/ssl/openssl.cnf
openssl.cafile => no value => no value
openssl.capath => no value => no value
Native OpenSSL support => enabled

So it seem that open ssl is there.

Cronix's avatar

In your .env, do you have tls or starttls for MAIL_ENCRYPTION? If it's starttls, try changing it to just tls. It would be good to post your settings. You can xxx out the username/password.

dan3460's avatar

I tried both on the .env file:

MAIL_DRIVER=smtp
MAIL_HOST=box.kolbach.biz
MAIL_PORT=587
MAIL_USERNAME=xxxxxxxxxx
MAIL_PASSWORD=xxxxxxxxxx
MAIL_ENCRYPTION=TLS

I get different errors: with TLS:

Production.ERROR: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed {"exception":"[object] (ErrorException(code: 0): stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed at /var/www/fsmadm.com/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php:94)

with STARTTLS:

[2018-09-25 00:08:41] Production.ERROR: Connection could not be established with host box.kolbach.biz [Unable to find the socket transport "starttls" - did you forget to enable it when you configured PHP? #32686] {"exception":"[object] (Swift_Transpor$
[stacktrace]
dan3460's avatar

I'm done testing today. I setup my development computer with the credentials above and worked fine, with encryption as TLS. I think there is definitely something not correctly configured in my production box.

dan3460's avatar

I have worked for about 6 hours on this problem and i'm not getting anywhere. I downloaded the Ca bundle certificates made sure that php.ini openssl.cafile is pointing to the downloaded certificate and nothing. I hit a roadblock. Don't know where to turn. Anyone has ideas?

dan3460's avatar

I setup a test site on the server and loaded a basic Laravel app that sends a test email. On my developing machine it sends emails no problem using the credential set above. On the test site doesn't work, so it is definitely a server problem. Now, on that same server i have a couple of applications that send email, they where built on Laravel 5.2, i was supposed to upgrade them to 5.7 to add more functions to the sites but that is on hold now. (good thing that i fund this problem before, other wise i will be in trouble). So, probably the email system in 5.7 got upgraded and now is checking for something that the old version did not checked for.

Any ideas will be appreciated.

dan3460's avatar

I could not solve this problem, i don't know if this is a web server problem or a mail server problem. Because i have to move on, i created a gmail account that I'm using to manage the emails from the site. Not the best solution but will have to do in the meantime.

D9705996's avatar

If the smtp server is using a self signed certificate you could try adding the following to your config/mail.php

'stream' => [
    'ssl' => [
        'allow_self_signed' => true,
        'verify_peer' => false,
        'verify_peer_name' => false,
    ],
],

Worth trying with both tls and starttlsIf it doesnt work post the full errors as SSL errors can be verbose but most of its important

1 like
dan3460's avatar

Thanks for the idea. I will try this weekend.

pol_php's avatar

Have You found any solution to resolve your problem with sending mails? I have this same problem.

tarzanking's avatar

have anyone find out the solution, I am facing the same problem

Please or to participate in this conversation.