It provides all the steps required to configure the OpenSSL module of PHP on Windows.

How To Configure PHP OpenSSL Module On Windows
How To Configure PHP OpenSSL Module On Windows
December 25, 2019

We need the relevant PHP module to communicate with an HTTPS or TLS server. This tutorial provides all the steps required to configure the OpenSSL module of PHP on Windows for communication over HTTPS or TLS protocols.

Step 1 - Verify Module

First of all, we will verify whether the SSL module is already installed and enabled by analyzing the output of the phpinfo function.

Write a program having the content as shown below. I have saved the file as info.php.

<?php
phpinfo();

Now execute it on the console using the PHP executable as shown below.

# Execute the php file
php info.php

# Output:

...
...
gzip compression => enabled
bzip2 compression => disabled (install ext/bz2)
OpenSSL support => disabled (install ext/openssl)

...
...

We can see that the OpenSSL support is disabled for the PHP installed on the system. The output of the same program on the browser is shown in Fig 1.

OpenSSL Info

Fig 1

Step 2 - Configure Module

In order to continue with this step, make sure that the php_openssl.dll is present within the ext directory of your PHP installation.

Now update the php.ini file as shown below.

....
....

extension=php_openssl.dll

....
....

Save the file and again run the info.php on the console. You should see the output as shown below.

openssl

OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 1.1.1a 20 Nov 2018
OpenSSL Header Version => OpenSSL 1.1.1a 20 Nov 2018
Openssl default config => C:\usr\local\ssl/openssl.cnf

If you run info.php in the browser, it should look like the one as shown in Fig 2. Make sure to restart Apache Web Server to reflect the changes.

OpenSSL Info Enabled

Fig 2

Summary

This is how we can enable the OpenSSL module of PHP on Windows. We can communicate over the HTTPS or TLS protocols after enabling this module.

Write a Comment

Click on the captcha image to get new code.
Discussion Forum by DISQUS