[ACCEPTED]-PHP OpenSSL extension not working while installing TYPO3 6.2.2 on Windows 7-php-openssl

Accepted answer
Score: 34

Solution that worked for me on XAMPP and 8 Windows Vista:

  • Activate the PHP module openssl

    Open php.ini and uncomment(delete 7 ';') in:

    ;extension=php_openssl.dll

    Double-check that the extension 6 is enabled by running phpinfo().

  • Add a system environment variable "OPENSSL_CONF" with value 5

    C:\xampp\apache\conf\openssl.cnf

    ...assuming you installed xampp into C:\xampp.

  • Set path to 'openssl.exe', which 4 is in C:\xampp\apache\bin

    • Either set $TYPO3_CONF_VARS['SYS']['binSetup'] in 3 ...\htdocs\typo3_src-6.2.x\typo3\sysext\core\Configuration\DefaultConfiguration.php to 'openssl=c:/xampp/apache/bin/openssl.exe'

    • or append c:\xampp\apache\bin to the environment variable 2 PATH (will work for every PHP script not 1 only TYPO3)

  • Restart xampp

Links/sources:

Score: 10

To enable OpenSSL on PHP under Windows, three 18 steps must be taken:

  1. enable the extension 17 – make sure to uncomment this line in php.ini:

    extension=php_openssl.dll

  2. Add 16 the PHP folder to the PATH environment variable 15 of Windows:

    Control Panel –> System –> Advanced 14 System Settings –> Environment Variables.
    Locate 13 the Path variable in the System Variables 12 block.
    Prepend c:\php; in front of it, or whatever 11 your PHP path is.

  3. Create an additional OPENSSL_CONF 10 environment variable for Windows which contains 9 the full path of the OpenSSL config file 8 of PHP:

    Control Panel –> System –> Advanced 7 System Settings –> Environment Variables.
    In 6 the System Variables block click New...
    Variable 5 name: OPENSSL_CONF
    Variable value: C:\php\extras\ssl\openssl.cnf
    Modify that value 4 to match your PHP installation directory!

Restart 3 Windows so the environment changes can take 2 effect.

Details on PHP OpenSSL support under 1 Windows can be found here.

Score: 3

On typo3 6.2.7on win7 XAMPP 1.8.3

The openSSL 15 error's solution was to create C:\openssl-1.0.1i-win32\ssl folder and 14 put E:\Portables\xampp\apache\conf\openssl.cnf into it. I got a direction about it 13 from a german website.

How I found it out 12 (just in case versions change), in the shell 11 on XAMPP control panel, openssl command 10 gives

WARNING: can't open config file: E:/Portables/xampp/apache/bin/openssl.cnf.

But 9 adding the file there does not help. I added 8 and removed the file.

Add ;E:\Portables\xampp\apache\bin to PATH environment 7 variable (System properties -> Advanced). Run 6 command openssl on a CMD window(not XMPP 5 shell), the message:

WARNING: can't open 4 config file: c:/openssl-1.0.1i-win32/ssl/openssl.cnf

Add 3 the file there, the addition to environment 2 variable PATH can be removed now.

Adding 1 OPENSSL_CONF also did not work for me.

Score: 1

Set a global environment variable OPENSSL_CONF 1 to %ProgramFiles(x86)%\PHP\Current\extras\openssl.cnf

Score: 0

The following solution might only work by 23 manual start of the Apache-Server by click 22 on apache_start.bat inside Xampp, other use-cases and server-packages 21 are not tested or covered.


Dealing with several versions of xampp and perhaps additional several frameworks I searched for 20 an approach that is best fitting to the 19 following requirements:

  • A framework never has to know about the configuration or the path to the executable openssl-file (in windows: openssl.exe).
  • It doesn't matter which server is started, the right path to openssl is always found, fitting to the version of the server. This avoids problems that openssl might be compiled with another version than PHP or Apache-Server.
  • Variables never have to be added unflexible and static to the PATH-Variable. Instead they shall only be added as long as a server is running.
  • Stopping one server-version and starting another server-version is switching without further actions to the right path of openssl.exe and openssl.cnf.

Based on these 18 developer-requirements the steps I describe 17 are a bit different than the running answers 16 on this page:

  1. Enable openssl in the php.ini-file 15 of each server-version (i.e. xampp-1, xampp-2, etc.) by 14 removing the leading semicolon of the following 13 line: ;extension=php_openssl.dll

  2. Open the file apache_start.bat of each server-version 12 and replace the line

    apache\bin\httpd.exe

    by the following 11 snippet:
    SET OPENSSL_CONF=C:\xampp-x\apache\conf\openssl.cnf IF EXIST C:\xampp-x\apache\bin SET PATH=%PATH%;C:\xampp-x\apache\bin apache\bin\httpd.exe

    Pay attention that you everywhere replace C:\xampp-x\ by the real path to the corresponding server.

  3. Restart xampp either by apache_start.bat 10 or by the xampp-control-panel.

This solution 9 naturally works also with only one server 8 and with the advantage having limited PATH-Variables 7 system-wide defined.

UPDATE If you have still problems 6 related to TYPO3, no matter about the method 5 you chosed, check the cookie_domain in the 4 installtool. It should apply to the current 3 domain or being empty. A wrong cookie-domain can happen if 2 you copy a project from another server, i.e. for 1 development.

Score: 0

Adding the path like below "config" => "D:/xampp/php/extras/openssl/openssl.cnf", solved the issue.

$key = openssl_pkey_new([
    "config" => "D:/xampp/php/extras/openssl/openssl.cnf",
    'digest_alg' => 'aes256',
    'private_key_type' => OPENSSL_KEYTYPE_RSA,
    'encrypt_key' => false,
    'encrypt_key_cipher' => OPENSSL_CIPHER_AES_256_CBC,
]);
openssl_pkey_export_to_file($key, $this->folder . '/private.pem');

0

More Related questions