Friday, July 3, 2009

Enabling extensions/dll in PHP of XAMPP

It has become common that as we work on our application locally, we might need to enable more and more extensions. For example, cURL and hash, they are not enabled on XAMPP's PHP by default.

What are extensions?
Extensions are DLLs (dynamically linked libraries) written in C and compiled, and that are added, enabled, disabled into PHP through the PHP configuration file php.ini. These extensions do not change your coding experience or the language, but in fact, they add on new sets of functions to your existing functions in PHP.

To enable the dynamic extensions you need in PHP, simply go to C:\xampp\apache\bin, open up php.ini, and search for "Windows Extensions" or "extension=".

Then, find the entry where your required DLL is written. If a ";" is at the front, remove it - that will uncomment the line so that PHP loads the extension.

Lastly, restart Apache server using XAMPP Control Panel and you should be able to use functions from your extension already.

Note that this works for any other servers as well as long as you are using PHP. but the configuration file might differ.

No comments: