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

search for in the

Configuración en tiempo de ejecución> <Requerimientos
Last updated: Fri, 20 May 2011

view this page in

Instalación

Para usar el soporte de OpenSSL en PHP debe también compilar PHP con --with-openssl[=DIR] .

La biblioteca OpenSSL también tiene requerimientos adicionales para la operación normal en tiempo de ejecución. En particular, OpenSSL requiere acceso a un generador de números aleatorios o pseudoaleatorios; en la mayoría de plataformas Unix y similares a Unix (incluyendo Linux), esto significa que se debe tener acceso a dispositivo /dev/urandom o /dev/random.

Note: Nota para los usuarios de Win32

Para que esta extensión funcione, hay unos ficheros DLL que deben estar disponibles en el sistema de Windows PATH. Para más información en como hacer esto, vea la FAQ titulada "Como añadir mi directorio PHP en el PATH de Windows". Aunque copiar los ficheros DLL desde el directorio PHP al directorio del sistema de Windows también funciona (porque el directorio del sistema por defecto es el PATH del sistema), esto no se recomienda. Esta extensión requiere que los siguientes ficheros esten en el PATH: libeay32.dll

Adicionalmente, si está planeando usar las funciones de generación de claves y firma de certificados, necesitará instalar un archivo openssl.cnf válido en su sistema. A partir de PHP 4.3.0, incluimos un archivo de configuración de ejemplo en nuestras distribuciones binarias de win32. En PHP 4.3.x y 4.4.x el archivo está en el directorio openssl. En PHP 5.x y 6.x el archivo está en el directorio extras/openssl. Si está utilizado PHP 4.2.x o ha perdido el archivo, puede obtenerlo en » la página de binarios de OpenSSL o descargar una versión reciente de PHP. Sepa que Windows Explorer oculta la extensión .cnf por defecto y dice que el tipo de archivo es SpeedDial.

PHP buscará el archivo openssl.cnf usando la siguiente lógica:

  • la variable de entorno OPENSSL_CONF, si está establecida, se usará como la ruta (incluido el nombre de archivo) del archivo de configuración.
  • la variable de entorno SSLEAY_CONF, si está establecida, se usará como la ruta (incluido el nombre de archivo) del archivo de configuración.
  • El archivo openssl.cnf se asume que está en el área de certificados por defecto, como se configuró en el momento en que la DLL de OpenSSL fue compilada. Esto normalmente significa que el nombre de archivo por defecto es c:\usr\local\ssl\openssl.cnf.

Durante la instalación, necesita decidir si instalar el archivo de configuración en c:\usr\local\ssl\openssl.cnf o si instalarlo en otro lugar y usar variables de entorno (posiblemente en base a un servidor virtual) para ubicar el archivo de configuración. Observe que es posible sobrescribir la ruta por defecto desde el script usando el parámetro configargs de las funciones que requieren un archivo de configuración.



add a note add a note User Contributed Notes Instalación
Kathryn Sharron at CSUN 19-Feb-2009 10: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 11: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.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites