简体   繁体   中英

PHP OpenSSL extension not working while installing TYPO3 6.2.2 on Windows 7

I've installed TYPO3 6.2.2 on Windows 7 but I got an error message as below:

PHP OpenSSL extension not working Something went wrong while trying to create a new private key for testing. Please check the integration of the PHP OpenSSL extension and if it is installed correctly.

I try to find the solution on the internet about this error but I cannnot solve this bug.

Can anyone help me to find the solution please? Thanks.

Solution that worked for me on XAMPP and Windows Vista:

  • Activate the PHP module openssl

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

    ;extension=php_openssl.dll

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

  • Add a system environment variable "OPENSSL_CONF" with value

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

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

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

    • Either set $TYPO3_CONF_VARS['SYS']['binSetup'] in ...\\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 PATH (will work for every PHP script not only TYPO3)

  • Restart xampp

Links/sources:

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

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

    extension=php_openssl.dll

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

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

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

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

Restart Windows so the environment changes can take effect.

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

On typo3 6.2.7on win7 XAMPP 1.8.3

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

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

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

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

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

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

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

Adding OPENSSL_CONF also did not work for me.

将全局环境变量 OPENSSL_CONF 设置为 %ProgramFiles(x86)%\\PHP\\Current\\extras\\openssl.cnf

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


Dealing with several versions of xampp and perhaps additional several frameworks I searched for an approach that is best fitting to the 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 developer-requirements the steps I describe are a bit different than the running answers on this page:

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

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

    apache\\bin\\httpd.exe

    by the following 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 or by the xampp-control-panel.

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

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

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');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM