OpenSSL Configuration Errors

This section provides a tutorial example on how to resolve OpenSSL module configuration errors. 'Unable to find the wrapper https' means that the OpenSSL module is not configured correctly.

To help you troubleshooting configuration errors, I also did some tests with some incorrect configurations.

1. Missing extension=php_openssl.dll in php.ini file.

Edit php.ini file again and comment out the extension=php_openssl.dll line:

...
extension_dir = "ext"
...
;extension=php_openssl.dll
...

Run my test script again:

herong> \local\php\php OpenSSL_HTTPS_file_get_contents.php \
   https://login.yahoo.com

PHP Warning:  file_get_contents(): Unable to find the wrapper "https"
- did you forget to enable it when you configured PHP?
in OpenSSL_HTTPS_file_get_contents.php on line 7

PHP Warning:  file_get_contents(https://login.yahoo.com):
failed to open stream:
Invalid argument in OpenSSL_HTTPS_file_get_contents.php on line 7

Execution failed because the OpenSSL module is turned off.

2. Failed to load php_openssl.dll.

Edit php.ini file again and comment out the extension_dir = "ext" line:

...
;extension_dir = "ext"
...
extension=php_openssl.dll
...

Run my test script again:

herong> \local\php\php OpenSSL_HTTPS_file_get_contents.php \
   https://login.yahoo.com

PHP Warning:  PHP Startup: Unable to load dynamic library
'C:\php\php_openssl.dll' - The specified module could not be found.
 in Unknown on line 0
...

Execution failed because the PHP engine is trying to load php_openssl.dll from the default location \php. The correct location is in the "ext" sub directory of the PHP home directory.

After finishing these tests, don't forget to undo changes you have made in the php.ini file.

Table of Contents

 About This Book

 Introduction of PKI (Public Key Infrastructure)

 Introduction of HTTPS (Hypertext Transfer Protocol Secure)

 Using HTTPS with Google Chrome

 Using HTTPS with Mozilla Firefox

 HTTPS with Microsoft Edge

 Using HTTPS with Apple Safari

 HTTPS with IE (Internet Explorer)

 Android and Server Certificate

 iPhone and Server Certificate

 Windows Certificate Stores and Console

 RDP (Remote Desktop Protocol) and Server Certificate

 macOS Certificate Stores and Keychain Access

 Perl Scripts Communicating with HTTPS Servers

PHP Scripts Communicating with HTTPS Servers

 Configuring PHP OpenSSL on Windows

 Testing OpenSSL with file_get_contents()

OpenSSL Configuration Errors

 SSL Context Options for OpenSSL

 Asking OpenSSL to Verify Server's Certificate

 OpenSSL Failing to Verify Server's Certificate

 Multiple CA Certificates in a Single File

 Testing OpenSSL with fopen()

 Testing OpenSSL with fsockopen()

 Adding CA Certificates for the PHP Engine

 Testing OpenSSL with stream_socket_client()

 Java Programs Communicating with HTTPS Servers

 .NET Programs Communicating with HTTPS Servers

 CAcert.org - Root CA Offering Free Certificates

 PKI CA Administration - Issuing Certificates

 Comodo Free Personal Certificate

 Digital Signature - Microsoft Word

 Digital Signature - OpenOffice.org 3

 S/MIME and Email Security

 PKI (Public Key Infrastructure) Terminology

 Archived Tutorials

 References

 Full Version in PDF/EPUB