Working with PHP extensions on IIS

7/11/2007

Getting PHP's extension to work with IIS can become a bit frustrating. I've had some problems using the postgres extension in my computer, and here's how I've solved them.

First you have to make sure that the extension that your trying to use is working. This can be done using a simple php page file like this:

< ?php
echo phpInfo();
?>

If you load this page in your web browser you'll get a lot of information about your current php setup. In this case we're looking for the postgres extension, hence the string "pgsql" must be present. Otherwise the extension is not loaded and we'll have to install it.

To do so, you'll have to download the PHP windows installer. Then run the installer and click on Change. Click on extensions and select the extension you're planning to use. In this case we'll click on PostgreSQL and select "Will be installed on local hard drive".

After the extension has been installed, go to the PHP's directory (usually located in Program Files/PHP) and edit the php.ini file. Look for the string "extension=php_pgsql.dll". If the installation process didn't update the file, then remove the semicolon from the line of your extension from the "; Windows Extensions" section of the file.

After that you'll have to restart the IIS process: go to Control Panel->Administrative Tools->Services, right click on World Wide Web Publishing and select Restart. Now your PHP+IIS setup will be able to deal with the extension.

Publicado por Herr Schönheit Von Vogelsang en 23:01 0 comentarios