On Windows, you have two ways to load a PHP extension: either compile it into PHP, or load the DLL. Loading a pre-compiled extension is the easiest and preferred way.
To load an extension, you need to have it available as a ".dll" file on your system. All the extensions are automatically and periodically compiled by the PHP Group (see next section for the download).
To compile an extension into PHP, please refer to building from source documentation.
To compile a standalone extension (aka a DLL file), please refer to building from source documentation. If the DLL file is available neither with your PHP distribution nor in PECL, you may have to compile it before you can start using the extension.
PHP extensions are usually called "php_*.dll" (where the star represents the name of the extension) and they are located under the "PHP\ext" ("PHP\extensions" in PHP4) folder.
PHP ships with the extensions most useful to the majority of developers. They are called "core" extensions.
However, if you need functionality not provided by any core extension, you may still be able to find one in PECL. The PHP Extension Community Library (PECL) is a repository for PHP Extensions, providing a directory of all known extensions and hosting facilities for downloading and development of PHP extensions.
If you have developed an extension for your own uses, you might want to think about hosting it on PECL so that others with the same needs can benefit from your time. A nice side effect is that you give them a good chance to give you feedback, (hopefully) thanks, bug reports and even fixes/patches. Before you submit your extension for hosting on PECL, please read http://pecl.php.net/package-new.php.
Many times, you will find several versions of each DLL:
You should keep in mind that your extension settings should match all the settings of the PHP executable you are using. The following PHP script will tell you all about your PHP settings:
Beispiel #1 phpinfo() call
<?php
phpinfo();
?>
Or from the command line, run:
drive:\\path\to\php\executable\php.exe -i
The most common way to load a PHP extension is to include it in your php.ini configuration file. Please note that many extensions are already present in your php.ini and that you only need to remove the semicolon to activate them.
;extension=php_extname.dll
extension=php_extname.dll
However, some web servers are confusing because they do not use the php.ini located alongside your PHP executable. To find out where your actual php.ini resides, look for its path in phpinfo():
Configuration File (php.ini) Path C:\WINDOWS
Loaded Configuration File C:\Program Files\PHP\5.2\php.ini
After activating an extension, save php.ini, restart the web server and check phpinfo() again. The new extension should now have its own section.
If the extension does not appear in phpinfo(), you should check your logs to learn where the problem comes from.
If you are using PHP from the command line (CLI), the extension loading error can be read directly on screen.
If you are using PHP with a web server, the location and format of the logs vary depending on your software. Please read your web server documentation to locate the logs, as it does not have anything to do with PHP itself.
Common problems are the location of the DLL, the value of the " extension_dir" setting inside php.ini and compile-time setting mismatches.
If the problem lies in a compile-time setting mismatch, you probably didn't download the right DLL. Try downloading again the extension with the right settings. Again, phpinfo() can be of great help.
To create a dll extension to
PHP follow this instructions:
http://blog.slickedit.com/2007/
09/creating-a-php-5-extension-with-visual-c-2005/
*****IMPORTANT
1)You MUST use the last release of PHP source code,
or people will not me able to use your extension.
Don't worry to use only the version of the tutorial.
2) The folder "regex" exists in PHP 5.3,
just find it in the subfolders.
3)While building your dll in Visual Studio,
if you have any problem compiling or linking like: "winsock2.h is missing"
, find the files on your computer and
include the project in the same way that the tutorial taught.
In response to soazine:
I've found, using wampserver, that the only configuration file that needs to be edited is the one listed under "Loaded Configuration File" given by phpinfo(). Those for whom this doesn't work should refer to soazine's steps.
This is the only way to get PECL extensions - using the command line installer (similar to the PEAR installer) does not work on Windows...
This does not look like its going to be fixed any time soon...
Also, you should look at http://pecl4win.php.net/ for Windows PECL extensions.
When using PHP 5.2.0 within WinXP via Wampserver ( http://www.en.wampserver.com/download.php ) you will find that just simply adding a PECL-based DLL file into php.ini is not enough. Steps you will have to do to ensure that your PECL extension(s) will be recognized are as follows:
1) Have the DLL referenced within PHP's php.ini ("extension=[php_name-of-PECL-extension].dll")
2) Have the DLL referenced within Windows' php.ini
3) Have the DLL within wampserver.ini
If any of these steps are not included, alongside the obvious web services restart, then PECL is not recognized.