downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Configuration à l'exécution> <Pré-requis
Last updated: Fri, 14 Aug 2009

view this page in

Installation

Pour utiliser le support OpenSSL de PHP, vous devez aussi compiler PHP avec l'option de configuration --with-openssl[=DIR].

Note: Note aux utilisateurs Win32
Afin de faire fonctionner cette extension, quelques bibliothèques DLL doivent être disponibles via le PATH du système Windows. Lisez la FAQ intitulée "Comment ajouter mon dossier PHP à mon PATH WIndows" pour plus d'informations. Le fait de copier les bibliothèques DLL depuis le dossier PHP dans le dossier système Windows fonctionne également (car le dossier système est par défaut dans le PATH système), mais cette méthode n'est pas recommandée. Cette extension nécessite que les fichiers suivants se trouvent dans le PATH : libeay32.dll
De plus, si vous avez prévu d'utiliser les fonctions relatives à la génération de clés et aux certificats, vous devez installer un fichier openssl.cnf valide sur votre système. Depuis PHP 4.3.0, nous incluons un fichier de configuration de base dans les distributions de PHP pour win32. PHP 4.3.x et 4.4.x ont ce fichier dans le dossier openssl. PHP 5.x et 6.x ont ce fichier dans le dossier extras/openssl. Si vous utilisez PHP 4.2.x ou bien si le fichier n'est pas présent, vous pouvez l'obtenir sur la page » des binaires OpenSSL ou en téléchargeant une version récente de PHP. Attention : Windows Explorer cache par défaut les fichiers dont l'extension est .cnf et indique que le type de fichier est SpeedDial.
PHP va rechercher le fichier openssl.cnf suivant la tactique suivante :

  • La variable d'environnement OPENSSL_CONF, si elle est définie, sera utilisée comme chemin (comprenant le fichier) vers le fichier de configuration.
  • La variable d'environnement SSLEAY_CONF, si elle est définie, sera utilisée comme chemin (comprenant le fichier) vers le fichier de configuration.
  • Le fichier openssl.cnf sera supposé se trouver dans le dossier des certificats, tel que configuré lors de la compilation de la bibliothèque openssl. Cela signifie généralement c:\usr\local\ssl\openssl.cnf.


Dans votre installation, vous devrez décider si vous allez installer le fichier dans c:\usr\local\ssl\openssl.cnf ou si vous allez le faire ailleurs et configurer une variable d'environnement (possiblement par site virtuel). Notez qu'il est possible de remplacer le chemin par défaut en utilisant le paramètre configargs des fonctions qui requièrent un fichier de configuration.



add a note add a note User Contributed Notes
Installation
Kathryn Sharron at CSUN
19-Feb-2009 11:40
I followed all of the instructions above to install on Windows and *still* couldn't get "OpenSSL support     enabled" from phpinfo(). The answer turned out to be in my php.ini file:

; Directory in which the loadable extensions (modules) reside.
extension_dir = "./"

I found php_openssl.dll in my /ext directory. I copied it up to the same directory as php.ini, but I expect that editing the extension_dir value would work too.
mtudor AT icefusion remove me DOT co uk
24-Oct-2008 01:52
SYMPTOMS AND SETUP
------------------

For anyone having problems enabling the PHP openssl extension on WINDOWS.

I uncommented:  extension=php_openssl.dll  and installed the latest versions of ssleay.dll and libeay.dll in <windows>\system32.

When I restarted my web server and examined phpinfo(), there was no "openssl" headed section (although there were references to openssl in other sections).

I also found this error in my web server logs (<apache dir>/logs/ssl.log and <apache dir>/logs/access.log).

PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\\Program Files\\PHP\\ext\\php_openssl.dll' - The operating system cannot run %1.\r\n in Unknown on line 0

I have PHP 5.2.6 running on Apache 2.2.3 for Windows.

CAUSE
-----

This was caused by PHP picking up the WRONG VERSIONS of libeay.dll and ssleay.dll, which were present in multiple locations on my computer.

When any application attempts to use a dll file in windows, the system searches for this file using the following order:
   1. The directory from which the application loaded.
   2. The windows\system32 directory.
   3. The windows\system directory.
   4. The windows directory.
   5. The current directory.
   6. The directories that are listed in the PATH environment variable.

   (http://msdn.microsoft.com/en-us/library/ms682586.aspx)

For PHP running under Apache, the application directory is <apache dir>\bin and NOT <php dir>.  PHP was finding OUT OF DATE versions of libeay.dll and ssleay.dll in <apache dir>\bin (probably installed when I enabled SSL support in my web server).  Because of this, the latest versions in windows\system32 were never reached.

NOTE: Although my problem was caused by an Apache2 specific configuration, I can imagine others might face this problem if, say, they install the openssl dlls in the PHP directory and add this directory to the PATH.  I haven't checked it but I would imagine if another directory in the path contains outdated openssl dlls and this is listed before the PHP directory, a similar situation would occur.

SOLUTION
--------

Either replace the dlls in the first location on the search order, or, as I did, you can install the latest openssl dlls in the the windows system32 directory and just rename to .old the ssleay.dll and libeay.dll files in the search order locations before windows\system32.

Hope that helps others who might be stuck with this.

Mark.

Configuration à l'exécution> <Pré-requis
Last updated: Fri, 14 Aug 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites