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

search for in the

PECL 拡張モジュールのインストール> <Windows システムへのインストール
Last updated: Fri, 29 Aug 2008

view this page in

Windows 用 PHP 拡張モジュール

Windows に PHP を インストールし、Web サーバの設定ができたら、 次は PHP 拡張モジュールを使うための設定です。 php.ini を使って PHP が起動時にロードする拡張モジュールを設定することができます。 もしくは、スクリプトの中で dl() 関数を使用することにより、 拡張モジュールを動的にロードすることも可能です。

PHP 拡張モジュールの DLL には、ファイル名の前に 'php_' が付いています。

Windows 版の PHP には、多くの拡張モジュールが 組み込まれています。これらの関数を使用する際には、 追加の DLL ファイルや extension ディレクティブの設定は不要です。 追加の DLL が必要となる (あるいはかつて必要だった) 拡張モジュールについては、 Windows 版 PHP 拡張モジュール の表にまとめてあります。以下にあげられている拡張モジュールは、すでに PHP に組み込まれています。

PHP 4 (PHP 4.3.11 時点): BCMathCaledarCOMCtypeFTPMySQLODBCOverloadPCRESessionTokenizerWDDXXML そして Zlib

PHP 5 (PHP 5.0.4 時点) では、さらに以下が組み込まれています。 DOMLibXMLIconvSimpleXMLSPL そして SQLite。 また、以下は組み込まれなくなりました。 MySQL および Overload

PHP が拡張モジュールを探すデフォルトの場所は PHP 4 の場合 C:\php4\extensions、 PHP 5 の場合 C:\php5 です。 変更するには php.ini ファイルを編集してください。

  • extension_dir を拡張モジュール があるフォルダに変更する必要があります。 php_*.dllファイルをそこに置いてください。 例えば次のようになります。

    extension_dir = c:\php\extensions
    

  • php.ini には、多くの拡張モジュール名がコメントアウトされた状態で記載済みです。 それらの拡張モジュールを有効にするには、php.ini 上の extension=php_*.dll の行をアンコメント(行頭の ; を削除する)してください。

    例1 Windows 版の PHP で Bzip2 拡張モジュールを有効にする

    // この行を以下から
    ;extension=php_bz2.dll
    
    // このように変更する
    extension=php_bz2.dll
    

  • 拡張モジュールによっては、その動作に外部 DLL が必要な場合があります。 配布パッケージには、一部の外部 DLL がバンドルされています。 PHP 4 の場合は C:\php\dlls\を、 PHP 5 の場合は親フォルダを参照ください。ただし、必要な外部 DLL がバンドルされていないモジュールもあり、たとえば、Oracle モジュール (php_oci8.dll) は、非バンドルの DLL を必要とします。 PHP 4 をインストールする場合、バンドルされた DLL を C:\php\dlls からメインのフォルダ C:\php へコピーしてください。 また、忘れずに C:\php をシステムパスに 追加してください(その方法は、別途 FAQ に記載されています。)

  • これらの DLLs の中には、PHP の配布ファイルに含まれていないものもあります。 詳細は、それぞれの拡張モジュールのドキュメントを参照ください。 また、PECL についての詳細は、マニュアルの PECL 拡張モジュールのインストール という節を参照ください。多くの PHP 拡張モジュールが PECL に移行しつつあり、これらは 個別にダウンロード しなければなりません。

注意: PHP をサーバモジュールとして実行している場合は、Webサーバを再起動しないと、 php.ini の設定が反映されません。Web サーバの再起動を忘れずに行ってください。

以下の表は、使用可能な拡張モジュールと それらの実行に別途必要な DLL のリストです。

PHP 拡張モジュール
拡張モジュール 説明 備考
php_bz2.dll bzip2 圧縮関数  
php_calendar.dll カレンダー 関数 PHP 4.0.3 以降ビルトイン
php_crack.dll Crack 関数  
php_ctype.dll 文字型(ctype) 関数 PHP 4.3.0 以降ビルトイン
php_curl.dll CURL, Client URL Library 関数 libeay32.dll および ssleay32.dll が必要 (バンドル)
php_dba.dll DBA: (dbm 型の) データベース・アブストラクション レイヤー関数  
php_dbase.dll dBase 関数  
php_dbx.dll dbx 関数  
php_domxml.dll DOM XML 関数 PHP <= 4.2.0 では libxml2.dll が必要 (バンドル), PHP >= 4.3.0 では iconv.dll が必要 (バンドル)
php_dotnet.dll .NET 関数 PHP <= 4.1.1
php_exif.dll EXIF 関数 php_mbstring.dllphp.iniphp_exif.dllphp_mbstring.dll の後で読み込まれる必要がある。
php_fbsql.dll FrontBase 関数 PHP <= 4.2.0
php_fdf.dll FDF: Forms Data Format 関数 fdftk.dll が必要 (バンドル)
php_filepro.dll filePro 関数 読み込みのみ
php_ftp.dll FTP 関数 PHP 4.0.3 以降ビルトイン
php_gd.dll イメージ 関数 (GD ライブラリ) PHP 4.3.2以降で削除。トゥルーカラー関数は GD1 では使用できない。 代わりに php_gd2.dll を使用のこと。
php_gd2.dll イメージ 関数 (GD2 ライブラリ) GD2
php_gettext.dll Gettext 関数 PHP <= 4.2.0 では gnu_gettext.dll が必要 (バンドル), PHP >= 4.2.3 では libintl-1.dll および iconv.dll が必要(バンドル)
php_hyperwave.dll HyperWave 関数  
php_iconv.dll ICONV 関数 iconv-1.3.dll が必要(バンドル)、 PHP >=4.2.1 iconv.dll
php_ifx.dll Informix 関数 Informix ライブラリが必要
php_iisfunc.dll IIS management 関数  
php_imap.dll IMAP,POP3,NNTP 関数  
php_ingres.dll Ingres II 関数 Ingres II ライブラリが必要
php_interbase.dll InterBase 関数 gds32.dll が必要(バンドル)
php_java.dll Java 関数 PHP <= 4.0.6 で jvm.dll が必要(バンドル)
php_ldap.dll LDAP 関数 PHP <= 4.2.0 では libsasl.dll が必要(バンドル), PHP >= 4.3.0 では libeay32.dllssleay32.dll が必要(バンドル)
php_mbstring.dll マルチバイト文字列 関数  
php_mcrypt.dll Mcrypt 暗号化 関数 libmcrypt.dll が必要
php_mhash.dll Mhash 関数 PHP >= 4.3.0 で libmhash.dll が必要(バンドル)
php_mime_magic.dll Mimetype 関数 magic.mime が必要(バンドル)
php_ming.dll Ming 関数 (Flash 用)  
php_msql.dll mSQL 関数 msql.dll が必要(バンドル)
php_mssql.dll MSSQL 関数 ntwdblib.dll が必要(バンドル)
php_mysql.dll MySQL 関数 PHP >= 5.0.0。libmysql.dll が必要(バンドル)
php_mysqli.dll MySQLi 関数 PHP >= 5.0.0。libmysql.dll (PHP <= 5.0.2 では libmysqli.dll) が必要(バンドル)
php_oci8.dll Oracle 8 関数 Oracle 8.1+ クライアントライブラリが必要
php_openssl.dll OpenSSL 関数 libeay32.dll が必要(バンドル)
php_overload.dll オブジェクトオーバーロード 関数 PHP 4.3.0 以降ビルトイン
php_pdf.dll PDF 関数  
php_pgsql.dll PostgreSQL 関数  
php_printer.dll プリンタ 関数  
php_shmop.dll 共有メモリ 関数 (shmop)  
php_snmp.dll SNMP 関数 NT のみ
php_soap.dll SOAP 関数 PHP >= 5.0.0
php_sockets.dll ソケット 関数  
php_sybase_ct.dll Sybase 関数 Sybase クライアントライブラリが必要
php_tidy.dll Tidy 関数 PHP >= 5.0.0
php_tokenizer.dll Tokenizer 関数 PHP 4.3.0 以降ビルトイン
php_w32api.dll W32api 関数  
php_xmlrpc.dll XML-RPC 関数 PHP >= 4.2.1 で iconv.dll が必要(バンドル)
php_xslt.dll XSLT 関数 PHP <= 4.2.0 では sablot.dllexpat.dll が必要(バンドル)。 PHP >= 4.2.1 では sablot.dll, expat.dll および iconv.dll が必要(バンドル)
php_yaz.dll YAZ 関数 yaz.dll が必要(バンドル)
php_zip.dll Zip ファイル 関数 読込のみ
php_zlib.dll ZLib 圧縮関数 PHP 4.3.0 以降ビルトイン



add a note add a note User Contributed Notes
Windows 用 PHP 拡張モジュール
ajs at replica dot company dot uk
17-Jul-2008 11:06
If you are having trouble getting extensions to run and changes to php.ini don't seem to make a jot of difference you may find that your php.ini is not being read and you are running on defaults.

The good news is that Elsint's fix (dated 26-Sep-2006) still works for php 5.2.6 under Windows Server 2003 SP2, on IIS6, running php as an ISAPI module.

Diagnostic:

run a test file

<php
phpinfo();
?php>

Load this in a browser and search the results for "Loaded Configuration File".  This points to the .ini file in use, which I have found is not always the one I have been editing ...

If your problem is with extensions: search for extension_dir in the phpinfo() results.  If the entry which follows is C:\PHP5, or some other directory which does not exist on your drive you may need the registry fix.  The alternative is to put the php.ini file somewhere along the search path, but this is not quite as clean.

Background:

If you run the installer packages: php-5.2.5-win32-installer.msi or php-5.2.6-win32-installer.msi and choose the default install directory the following registry entires are added

HKEY_LOCAL_MACHINE
  SOFTWARE
     PHP
      InstallDir  REG_SZ C:\Program Files\PHP\
      WebServerType REG_SZ iis4ISAPI

However, the installers above do not create the IniFilePath registry entry.

So: you either go for a direct registry hack or create and run a registry file named: "[whatever].reg"

If your install directory is the default for the above installers the contents should be the 4 (four) lines below (counting the blank one!) between the pseudo tags.

<whatever.reg>
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\PHP]
"IniFilePath"="C:\\Program Files\\PHP"
</whatever.reg>

(Note you have to have the double backslashes for the .reg file to work even though Windows reports it worked without them).

Once you have the new registry key in place you may find it sufficient to restart the World Wide Web Publishing Service, which is also restarted if you take the slightly longer option of restarting the IIS Admin Service. 

If this works for you and you want to backtrack by undoing the registry changes to test if this was the fix that did it: you may need a reboot (not just a service restart) because of some rather irritating persistencies.
php at vondi dot no-ip dot com
07-Jun-2008 08:46
If you get errors like this:
PHP Notice: Constant XML_ELEMENT_NODE already defined in Unknown on line 0

And many more complaining about XML constants, comment out the line:
extension=php_domxml.dll
in your php.ini. That extension seems to be compiled into PHP when you get those errors or something else is including the functionality before that dll.
smaines at alaya dot com
15-Feb-2008 11:51
== Problem

Consider the following from an httpd.conf file...

  LoadModule php5_module "E:/xyz/php/php5apache2_2.dll"
  PHPIniDir "E:/xyz/php"

...which led to the dreaded...

  PHP Warning:  PHP Startup: Unable to load dynamic library 'E:\\xyz\\php\\ext\\php_mysql.dll' - The specified module could not be found.

Note, however, that PHP.exe apparently was found and executed php pages in Apache, but the MySQL functions therein failed.

== Solution

Because PHP dir was not in $PATH, php5apache2_2.dll failed to find php_mysql.dll (the only extension I enabled) during Apache 2.2 start.

== Caveat (!)

The BIG issue is that, setting $PATH in...

  <desk icon>My Computer
  <rt click>Properties
  <tab>Advanced
  <button>Environment Variables

...didn't export the $PATH change such that restarting the Apache service (in MMC) would pick it up.  So I tested the working solution (adding PHP dir to $PATH), but it failed because of HOW I set it. It succeeded only when I REBOOTED after changing the $PATH.  There may be an easier way that this, but I do not know it at present.

== Comment

Consider whether PHP dir should need to be in $PATH at all, when PHP.exe apparently was found and executes php pages in Apache, but php5apache2_2.dll failed to find whatever was needed to load the extensions.  This should perhaps be addressed.

Note that on a WAMP installation (W2K,Apache,MySQL,PHP), only PHP is required in $PATH.
Manda Krishna Srikanth
30-Jan-2008 01:10
As far as my experience says, 95% of ext\php_mysql.dll - The specified module could not be found - error can be sorted out on Win 2003, IIS 6, PHP5.2.

Replace the php_mysql.dll and libmysql.dll downloaded from http://dev.mysql.com/downloads/connector/php/ into extensions directory.

For MSSQL connectivity problems, replace the ntwdblib.dll in php dir with the one copied from system32 directory. Ofcourse the filesize will be less, no problem, replace it.
jma59 at cam dot ac dot uk
22-Sep-2007 02:00
Under windows, given an error similar to

PHP Warning:  PHP Startup: Unable to load dynamic library 'c:\\php\\ext\\php_mysql.dll' - The specified module could not be found.\r\n in Unknown on line 0

When PHP definitely should be able to find the module, it's fairly common knowledge that this error can also be caused by  certain dlls not being in the PATH. These dlls (usually libeay32 and ssleay32) are generally found in your base php directory, and the modern windows installers add the base php directory to the PATH so that you don't need to worry about it. However, if when installing earlier versions you decided on moving libeay32, ssleay32 et al to C:\Windows\System32 instead of changing the PATH, then php will still end up with the old versions and the out of date versions will cause the same error as above. Don't fall into the trap like I did.
JerryG
30-Aug-2007 10:12
Installing PHP extensions for IIS for the first time is sort of a baptism by fire -- you will get your hands dirty, and other suitable metaphors of nastiness.  Hopefully, you won't have to spend too many days googling around fora and restarting IIS 10 million times as I did until I finally realized both what was going on and what crazy things I'd done wrong.

THIS (peter)guy really goes into terrific detail and troubleshooting, (with very good reasons and explanations of extension dependencies not listed on the current php page you're now reading):

http://www.peterguy.com/php/install_IIS6.html

Most of this is applicable for IIS5.1 as well, as far as I've found.

The main problem I'd been butting my head up against was extensions being reported as not found, even though the .DLLs were definitely in C:\PHP\ext, and my PATH env var was setup correctly. 

The error messaging during dynamic loading of implicitly-linked libraries should be more specific, telling you that in fact it is a particular dependency of a dependency which is missing -- usually some obscure third-party .dll -- and name it!

Eventually I stopped being so greedy and just cut down on the extensions I thought I needed by commenting them out in php.ini.  That eliminated the startup errors.  Apparently some of these extensions or their requirements, which either come with the base PHP install zip or the PECL extensions, are either too obscure or too fragile to be necessary anyway.

Good luck, and I hope anyone who runs into the same trouble can hit upon this or Peter Guy's page directly before they go too crazy.
glenn65535 AT yahoo DOT com
13-Feb-2007 09:51
When confronted with the problem "PHP Warning:  PHP Startup: Unable to load dynamic library './php_mysql.dll' - Access is denied.\r\n in Unknown on line 0" I found I had to make the permissions "chmod.exe 755 php_mysql.dll"
(This is on a Windows XP, but I am running Cygwin).
YYE (yeyuancn2 at yahoo dot com)
15-Nov-2006 10:10
I just installed PHP5.2 + Apache2.2 + MySQL5 on Windows XP. Three imporatant things.
1. I tryed to put php.ini in windows directory like in early version. But php can't load it and using default values only. After I put php.ini into php installation directory, everything is fine.
2. You still need to copy libmysql.dll to windows\system32 directory for the mysql extension to work.
3. Don't forget for apache 2.2, you need php5apache2_2.dll instead of php5apache2.dll.
Freddo
12-Oct-2006 03:11
We tried to install PHP 4 ISAPI Module on IIS 6 on a Windows Server 2003 SP2 at the office.

The only way we found out to make these extensions work, is by putting the extensions DLLs in the System32\inetsrv in the Windows directory. We did the same previously with the
php4isapi.dll and php4ts.dll to make PHP work. The system was asking for a password previously.

We cannot explain it, it seems like a problem only occuring with SP2 installed because we never had this problem before. Giving the right permission to the PHP and extensions folders didn't do anything good. It always gave use a permission denied error. We even tried to give full control to Everyone on the PHP folder, same result.

I hope it can help.
elsint at yahoo dot com
26-Sep-2006 08:38
Installing PHP5.1.6 on an IIS5.1 system.

Some extensions are not working because of registry(like LDAP).

You need to create a registry file named: "inifilepath.reg"
Content should be the 3 lines under,be sure to define your PHP path correct:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\PHP]
"IniFilePath"="C:\\PHP"

After creating this file, double click it, click yes, and restart IIS. Hopefully this might solve problem for some, as it solved for me.
simi_def at c2 dot hu
17-Aug-2006 10:10
I had problems with PHP5/Apache2.2/MySQL 5 installation on a WinXp machine.

I got the

Fatal error: call to undefined function - mysql_connect().

message

Solution :
1, use correct version of ext\php_mysql.dll and libmysql.dll
2, !!! edit the CORRECT php.ini (%windir%\php.ini) like c:\windows\php.ini !!!
3, add php installation dir to PATH
4, edit php.ini to load extension php_mysql.dll

use
<?php
phpinfo
();
?>
to check.
hevesir at t-mobile dot hu
07-Apr-2006 10:54
If You try to install PHP5 to IIS6 with Oracle....

Then You need some kind of pilot-exams, not for big planes, just a little one.

So: After installations (php.ini is correct see above ie.: extenstion = php_oci8.dll etc)

If You use anonymous access, You'll  have a builtin user to use it. Make this user local administrator, or give minimum read access to PHP folder (ie.: c:\php) and ORAHOME (ie. c:\ora92) folders.

If You use Windows Integrated authentication, give for Domain Users minimum read access to PHP folder (ie.: c:\php) and ORAHOME (ie. c:\ora92) folders.

Goog luck.
sopp_ladios at hotmail dot com
19-Aug-2004 06:35
[editor note: this should be fixed in PHP 5.1.0]

The order of the extensions listed in php.ini is causing problems... one must check that a particular extension A is enabled and above extension B if B requires A to be enabled.
The original ordering doesnt make sure that this always happens (ie, A is above B)

I came into this problem when I tried to enable the exif extension under windows. I knew mbstring is required but I kept getting errors even after I enabled both.
The problem can only be fixed by moving the mbstring line above the exif line...

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