Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm getting the following error when trying to connect to SMTP + SSL through PHP using nginx + PHP 5,

Could not connect to smtp host 'ssl://smtp.gmail.com' (5) (Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?)

In phpinfo I see:

OpenSSL support     disabled (install ext/openssl) 

This leads me to believe I've installed OpenSSL incorrectly.

I've read a bunch of places where I should uncomment the following line:

extension = php_openssl.dll

This line does not exist so I added it to the end of my php.ini to no avail. The php_openssl.dll file does not exist anywhere on my server.

share|improve this question

2 Answers 2

The line you are mentioning indeed does activate the openssl PHP-Extension on Windows Machines - though i doubt you are running nginx on Windows.

extension=openssl.so loads the openssl extension on my Box, you need to have PHP compiled with openssl Support:

--with-openssl[=DIR]

or/and advise the Package Management of your Distro to build the Extension at all/correctly.

share|improve this answer

The php_openssl.dll file does not exist anywhere on my server

Then you need to install it (it also requires a compatible openSSL installation). Peering into my crystal ball I see that you are running on MSWindows - did you use a packaged installation for PHP? If so which one?

The binary distribution from php.net includes the php stub dll - if it's not on your machine you may need to reinstall php. Then install openssl and enable loading of the extension.

Alternatively you could just route the SMTP traffic via stud/stunnel

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.