WSO2 WSF/PHP Installation Guide

This document guides you on how to install the WSO2 Web Services Framework/PHP extension, and run the server and client samples on Linux and Microsoft Windows operating systems.

Please send your feedback to the user mailing list: wsf-php-user@wso2.org. subcribe

Contents

  1.  Installing and Running on Linux
    1.  Prerequisites
    2.  Installing
  2. Installing and Running on Microsoft Windows
    1. Prerequisites
    2. Building
    3. Installing WSO2 WSF/PHP Binary
  3. Installing using pecl tool

1. Installing and Running on Linux

1.1  Prerequisites

     In order to build and run the WSF/PHP Linux source distribution, you need to have the following software installed on  your system.

  1. PHP 5.2.0 or later, which can be downloaded from the PHP official Web site. Please refer to the additional note on installing PHP as a DSO module to the Apache2 Web server.  If you are using a pre-installed version of PHP, please make sure that you have the developer version installed, so that you can compile the WSO2 WSF/PHP source.
  2. OpenSSL  Download

1.2  Installing

1. Go to the directory where you have extracted the source distribution. Run the following:

Note: You may require super user privileges to run 'make install' on your system.

2. After installing the extension, you have to edit the php.ini file and add the following line to the php.ini
extension=wsf.so 

3. If you have not enabled php_xsl extension that comes with PHP, then enable it as follows.   

extension=xsl.so

If you are using the source distribution, in order to install xsl extension go to ext/xsl directory and do 

Set extension_dir entry to point to your extension installation directory.

eg extension_dir="usr/local/lib/php/extensions/debug-zts-***". The last directory depends on your php version.

Uncomment the include_path and edit it to point to the location for scripts folder as

include_path = ".:/path/to/scripts/folder"

4. Also, copy all the samples to your Web server's document root.

5. Test with a Web browser. For example, access http://localhost/samples/echo_client.php

Notes:

2. Installing and Running on Microsoft Windows

2.1 Prerequisites

To build WSO2 WSF/PHP from source you will need the following dependency libraries.

OpenSSL binary distribution (Use MSI installer)

In addition you need to have Microsoft Visual Studio installed on your system.

2.2 Building

WSF/PHP extension is build on top of WSF/C Web Services Framework.  The extension source code is packaged with WSF/C code. When you download the wso2-wsf-php-src.zip file, it will contain following directory structure.

        wso2-wsf-php-src
            | 
            +---src 
            | 
            +--- wsf_c 
            | 
            +--- docs 
            | 
            +--- samples 
            | 
            +--- scripts 
        

In the wso2-wsf-php-src directory you will find a file named configure.in file. Open this file and set your dependency directory locations to relevant entries. You can build with debug symbol by setting DEBUG=1 option. Next run the build.bat file located in wso2-wsf-php-src directory. It should build the binary dist pack to wso2-wsf-php-src directory.

Now follow the installation steps under 2.4 Installing WSO2 WSF/PHP binary to configure the extension.

( Before running the build.bat file, add your vcvars32.bat  file location to PATH environment variable. IF you are using vc2005, it is located in C:\Program Files\Microsoft Visual Studio 8\VC\bin )

2.4 Installing WSO2 WSF/PHP Binary

1. If you built the extension from the source, you will find the wso2-wsf-php-bin-x.y.z-win32 (binary pack) located in your source directory.

  You can get the binary pack by downloading and extracting the binary distribution as well. 

It will have the following structure

        wso2-wsf-php-bin-z.y.z-win32
	           |
                    +-- wsf_c
                    |
                    +-- wsf.dll
                    |
                    +-- docs
                    |
                    +-- scripts
                    |
                    +-- samples 

2. Copy wsf.dll to the <PHP installation directory>/ext directory.

3. Add wso2-wsf-php-bin-x.y.z-win32\wsf_c\lib directory to the PATH environment variable.

4. Add the above listed dependency library dlls to the PATH environment variable.

5. Add the following entries to your php.ini file which is in your PHP installation location.

Set entension_dir entry to your extensions directory.

extension_dir ="./ext"

Enable wsf extension.
extension=wsf.dll

Set WSF/PHP configuration options.

[wsf]
wsf.home="<path_to_extract_folder>\wsf_c"
wsf.log_path="<path to extract_folder>\wsf_c\logs"
wsf.log_level=3

wsf.rm_db_dir="<path to extract_folder">\wsf_c"

Also enable php_xsl extension

extension = php_xsl.dll

Uncomment the include_path and edit it to point to the location for scripts folder as

include_path = ".;/path/to/scripts/folder"

6. Configure the Apache2 Web server with PHP as follows.

     6.1. Copy php5apache2.dll to Apache2/modules directory and add the following entries in httpd.conf file.

     LoadModule php5_module modules/php5apache2.dll
     PHPIniDir "< your php.ini file location> "

     AddType application/x-httpd-php .php .phtml
     AddType application/x-httpd-php-source .phps

7. Copy the samples folder to your Apache Web server's document root. If you want to run samples

Now you should be able to run the samples in the samples directory.

Note:- We ship windows binary with SSL enabled by default. Therefore, you would need to have ssl configured in apache as well.

3 Installing using pecl tool [ not available with 2.1.0 release ]

You can use the pecl tool to install WSO2 WSF/PHP.

1. First you need to download and install WSO2 WSF/C Web Services framework latest version. You can use the source distribution.

2. Download the WSO2 WSF/PHP pecl package. Next use pecl tool to install package.
    pecl install wso2_wsf_php_x.y.z.tgz
    Or
  pecl install http://dist.wso2.org/products/wsf/php/wso2_wsf_php-x.y.z.tgz

This will compile and install WSO2-WSF/PHP to you php extensions directory. It will copy the docs to /usr/local/lib/php/doc/wso2_wsf_php directory and it will copy the scripts and samples folders to the /usr/local/lib/php directory. Copy the samples directory to Apache2 Servers document root.

3.  Add following entries to your php.ini file.
     extension=wsf.so
     wsf.home = /opt/wso2/wsf_c (This is the default installation location of WSF/C)
     log_level = 3

Uncomment the include_path entry and edit it to point to the location for scripts folder as
include_path = ".:/usr/local/lib/php/wso2_wsf_php/scripts"

[ Note: You need to have php_xsl extension installed on your system for WSDL mode to work. Also the above specified paths may change depending on your system.]