Enabling SSL Transport in PHP on IIS (Windows)

I have a number of WordPress installations on a Windows Server running under IIS. Now, if you have installed something similar, you would know that email notifications don’t work out-of-the-box. I decided to enable these notifications, and I didn’t want to use plugins (besides, a number of plugins didn’t work for me).

On top of this, I wanted to use Gmail as my SMTP server to send the notifications, and not only does Gmail require SMTP Authentication, but it requires you to do it over a SSL protocol. This is where my troubles started. It took a long while to get SSL transport going on my box.

But finally, I have it down to reproducible steps:

  • libeay32.dll and ssleay32.dll – these two files are what you need to have present somewhere in your Windows Path. The problem is that typically, they are present in multiple locations and are of different versions. You need to make sure that you get the latest version (from here) and copy them at all locations (rename the old versions). The usual locations are: C:\Windows, C:\Windows\System32, and C:\Program Files\PHP.
  • php_openssl.dll – this is another very important file which (depending on your PHP installation) may or may not be present in the right place. Although this is part of the standard PHP installation, if you don’t have it, you can get it here. This file needs to be present in your PHP extensions directory, which is usually C:\Program Files\PHP\ext. Make sure it is present.
  • php.ini – this file probably causes the most problems when it comes to PHP configuration issues. The reason is that it is usually present in multiple places, but only one is being used – so make sure that you change the right one. This is usually present in C:\Program Files\PHP. Open the file and un-comment the line extension=php_openssl.dll (if no such line is present, simply add it).

There’s another file that you need if you want to run a SSL site (I think) – openssl.cnf. But in my case, I needed to initiate SSL connections and not create responses for SSL requests.

That’s it. You should be all set. Leave a comment if you are still facing trouble and I can try and help.

If you found this content helpful, then please help by linking to me. You can also help me by sharing the content using any of these nifty buttons above. Thank you.



You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

2 Responses to “Enabling SSL Transport in PHP on IIS (Windows)”

  1. Hi Vaibhav, thank you for this blog post :D . Helps me a bit.

    .tre.

    Reply
  2. Where is the openssl.cnf supposed to be located? Thanks

    Reply




Leave a Reply