PHP Web Services With IIS

Tuesday, April 1, 2008

It is possible for you do deploy PHP Web Services using WSF/PHP in IIS. Following the steps to install WSF/PHP in IIS.

1. Configure PHP With IIS.

You can find a complete guide to installing PHP with IIS from php documentation. http://www.php.net/manual/en/install.windows.iis.php

2. Configure WSF/PHP with PHP

Configuring WSF/PHP with PHP is quite easy. But you have to follow few additional steps to get it working on IIS.

i. Extract wsf/php binary can copy wsf.dll to your php extensions directory.

ii. Set following php.ini settings.

extension_dir=E:\php5\ext    { Here my E:\php5 is the location where I have extracted the php binary. Note that I have not used any quotes in the php. If you have paths, It will not work properly.

wsf.home=<path to php binary extract directory>\wsf_c\lib

wsf.log_path=<path to php binary extract directory>\wsf_c\logs

wsf.rm_db_dir=<path to php binary extract directory>\wsf_c\

wsf.log_level=4

iii) add wsf php dependencies and <wsf-php-bin>\wsf_c\lib directory to path System variable

3. Copy the samples, start IIS

Copy the samples directory to C:\Inetpub\webroot directory.

Start IIS with the following command

net start w3svc

Now use the <?php phpinfo(); ?> script to check whether wsf extension is load properly. You can simply copy and paste the above script to a file and put it in to C:\inetpub\webroot directory and try it. If the wsf extension is show in the page then all is fine. If it is not there check whether you have added the dependencies ( Libxml2, iconv) and <wsf-php-bin>\wsf_c\lib directory to the path system variable properly. Sometimes you may need to restart the machine to get these changes to the path to work properly.

Once you have the wsf extension loaded, you can run the samples.

No comments: