Mert METİN
Mert METİN

Reputation: 1288

Enabling the OpenSSL in XAMPP

I spent three hours but I did not find anything; I'm unable to connect to a SSL enabled server. I want to list what i did:

First checked my PHP extensions directory was in order; extension wasn't there, php_openssl.dll

Then I opened my php.ini file but I could not see any extension=php_openssl.dll line to uncomment.

Also, I searched on Google and saw people with the same problem. http://www.apachefriends.org/f/viewtopic.php?p=162623

However, I also have

OPENSSL_CONF C:/xampp/apache/bin/openssl.cnf 
...
openssl
OpenSSL support enabled 
OpenSSL Library Version OpenSSL 0.9.8l 5 Nov 2009 
OpenSSL Header Version OpenSSL 0.9.8l 5 Nov 2009

no lines . What should I do? Please share your suggestions.

Upvotes: 56

Views: 162142

Answers (10)

BurninLeo
BurninLeo

Reputation: 4474

So, what did we do to make openssl_pkey_new() and all the other openssl_ functions in PHP work...

  • Enabled the extension php_openssl.dll in the (right/active) php.ini. Checked.
  • Checked that there exists a openssl.cnf in xampp\apache\conf\ (and also in two other directories within XAMPP). Checked.
  • Added the environment variable OPENSSL_CONF in the Windows system settings with the full path to the above openssl.cnf. Checked.
  • Restarted Apache (and after that did not work restarted the computer several times...). Checked.

Still does not work, and throwing errors such as

  • error:0E06D06C:configuration file routines:NCONF_get_string:no value
  • error:02001002:system library:fopen:No such file or directory
  • error:2006D080:BIO routines:BIO_new_file:no such file

Okay, here are another two more things to check.

1. Trouble with the environment

Run phpinfo() from a PHP script, and go to the "Apache Environment" section. Check the value of OPENSSL_CONF.

Surprise. This is not what we have set in the windows system settings.

The solution is simple. Set the environment variable in the PHP script.

putenv('OPENSSL_CONF=C:\xampp\apache\conf\openssl.cnf');

2. Trouble with relative filenames

Now, openssl_pkey_new() will work, but openssl_pkey_export_to_file() does still not work and returns false without any further explanation?

Check the filename that you have specified as output filename. It will not work in Windows as long as you do not specify the full path.

$folder = realpath('../keyring');
$outfile = $folder.'/private.pem';
openssl_pkey_export_to_file($key, $outfile);

Upvotes: 3

Tristanisginger
Tristanisginger

Reputation: 2683

Although not related to this question but as the WP migrate Pro docs link to this question I though I would post an answer here.

If your having problems with DB Migrate Pro activating instead of enabling SSL you can just add a line of code to your wp-config

define( 'WPMDB_LICENCE', 'XXXXXXXXXXx' );

Upvotes: 0

Mr.Lister
Mr.Lister

Reputation: 432

I am assuming that this question is for those using a windows based system.

After making sure that the extension extension=php_openssl.dll in your php.ini file does not have a semicolon.

Then make sure that you have added C:/xampp/apache/bin into your environment path in order to use openssl without having move the command prompt to that directory C:/xampp/apache/bin

Upvotes: 0

Shahbaz A.
Shahbaz A.

Reputation: 4356

Things have changed for PHP > 7. This is what i had to do for PHP 7.2.

Step: 1: Uncomment extension=openssl

Step: 2: Uncomment extension_dir = "ext"

Step: 3: Restart xampp.

Done.

Explanation: ( From php.ini )

If you wish to have an extension loaded automatically, use the following syntax:

extension=modulename

Note : The syntax used in previous PHP versions (extension=<ext>.so and extension='php_<ext>.dll) is supported for legacy reasons and may be deprecated in a future PHP major version. So, when it is possible, please move to the new (extension=<ext>) syntax.

Special Note: Be sure to appropriately set the extension_dir directive.

Upvotes: 4

mpalencia
mpalencia

Reputation: 6007

STEP 1: On your php.ini comment out ;extension=php_openssl.dll

STEP 2: Copy libeay32.dll and ssleay32.dll from your PHP root folder and paste it your Apache/bin folder

STEP 3: Restart Apache

Upvotes: 0

Roni davelman
Roni davelman

Reputation: 119

You will need to edit your php.ini. It's 4 easy steps.

Find your php.ini file.

$inipath = php_ini_loaded_file();

Enable openssl in the file:

extension=php_openssl.dll 

Turn allow_url_fopen on

allow_url_fopen = On

Restart apache and you are done!

Upvotes: 1

Memochipan
Memochipan

Reputation: 3465

Yes, you must open php.ini and remove the semicolon to:

;extension=php_openssl.dll

If you don't have that line, check that you have the file (In my PC is on D:\xampp\php\ext) and add this to php.ini in the "Dynamic Extensions" section:

extension=php_openssl.dll

Upvotes: 111

sameer.nuna
sameer.nuna

Reputation: 554

In xampp, if "extension=php_openssl.dll" is not present in your php.ini file then add it in the "Windows Extensions" section of your php.ini file and restart your apache. It works for me..

Upvotes: 2

macio.Jun
macio.Jun

Reputation: 9895

I use xampp. Beforehand I tried the example file "test_smtp_gmail_basic.php" in phpMailer (you can download phpMailer here: https://github.com/Synchro/PHPMailer), but I got the following error:

Mailer Error: The following From address failed: [email protected]

After I commented out ; extension=php_openssl.dll in php.ini, it is working now.

Upvotes: 2

Mert METİN
Mert METİN

Reputation: 1288

[PHP_OPENSSL]
extension=php_openssl.dll

This is the answer.

Upvotes: 9

Related Questions