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

search for in the

実行時設定> <要件
Last updated: Fri, 13 Nov 2009

view this page in

インストール手順

PHP の OpenSSL サポートを使用するには、--with-openssl[=DIR] を指定して PHP を コンパイルする必要があります。

注意: Win32 ユーザへの注意
この拡張モジュールを動作させるには、 Windows システムの PATH が通った場所に DLL ファイルが存在する必要があります。 FAQ の "Windows で PHP のディレクトリを PATH に追加するにはどうすればいいのですか?" で、その方法を説明しています。 DLL ファイルを PHP のフォルダから Windows のシステムディレクトリにコピーしても動作します (システムディレクトリは、デフォルトで PATH に含まれるからです) が、これは推奨しません。 この拡張モジュールを使用するには、以下のファイルが PATH の通った場所にある必要があります。 libeay32.dll
加えてキー生成およびサイン認証関数を使用する計画がある場合、 システムに 有効な openssl.cnf をインストールする 必要があります。PHP 4.3.0 以降では、 Win32 バイナリ配布版にサンプル設定ファイルが同梱することにしました。 PHP 4.3.x および 4.4.x の場合は openssl ディレクトリ、 PHP 5.x および 6.x の場合は extras/openssl ディレクトリにあります。 PHP 4.2.0 以降を使用しておりこのファイルがない場合は、 » OpenSSL バイナリのページから入手するか、 あるいはより新しい版の PHP をダウンロードしてそこから設定ファイルを使用することができます。 Windows のエクスプローラは、拡張子 .cnf をデフォルトで非表示とすることに注意しましょう。この拡張子のファイルの種類は 短縮ダイヤル と表示されます。
PHP は、 以下のロジックにより openssl.cnf を探します。

  • 環境変数 OPENSSL_CONF が設定された場合、 設定ファイルの(ファイル名を含む)パスとして使用されます。
  • 環境変数 SSLEAY_CONF が設定された場合、 設定ファイルの(ファイル名を含む)パスとして使用されます。
  • ファイル openssl.cnf はデフォルトの認証エリアに あることが仮定され、openssl DLL がコンパイルされた時間で設定されます。 通常、デフォルトのファイル名が c:\usr\local\ssl\openssl.cnf であることを 意味します。


インストール時に、設定ファイルを c:\usr\local\ssl\openssl.cnf または 他の場所にインストールし、(例えば仮想ホスト毎に)環境変数に設定ファ イルの場所を指定するかを選ぶ必要があります。 設定ファイルを必要とする関数の configargs に より、デフォルトのパスを上書きすることが可能であることに注意してください。



add a note add a note User Contributed Notes
インストール手順
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.

実行時設定> <要件
Last updated: Fri, 13 Nov 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites