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:

C:\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:

C:\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.

Last update: 2011.

Table of Contents

 About This Book

 Introduction of PKI (Public Key Infrastructure)

 Introduction of HTTPS (Hypertext Transfer Protocol Secure)

 Using HTTPS with IE (Internet Explorer) 10

 Using HTTPS with Chrome 40

 Using HTTPS with Firefox 35

 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()

 Java Programs Communicating with HTTPS Servers

 Certificate Stores and Certificate Console

 .NET Programs Communicating with HTTPS Servers

 CAcert.org - Root CA Offering Free Certificates

 PKI CA Administration - Issuing Certificates

 Digital Signature - Microsoft Word 2007

 Digital Signature - OpenOffice.org 3

 S/MIME and Email Security

 PKI (Public Key Infrastructure) Terminology

 Outdated Tutorials

 References

 PDF Printing Version