Monday, October 15, 2007

Building WSF/PHP From source

WSF/PHP is an extension for PHP that provide WS* web Services support for PHP. It is build on top of WSF/C Framework. Since there was number of questions on the forum on how to build WSF/C from source on Win32 Platfrom I thought of writing the steps down.

First you need to download the dependency libraries needed. Here is a list of them.

1. Libxml2 (http://www.zlatkovic.com/pub/libxml/)

2. Iconv (http://www.zlatkovic.com/pub/libxml/)

3. zlib (http://www.zlatkovic.com/pub/libxml/)

4. PHP source and binary ( www.php.net )

5. PHP build utilities (http://www.php.net/extra/win32build.zip)

6. WSO2-WSF/PHP extension source. (http://dist.wso2.org/products/wsf/php/wso2-wsf-php-src-1.1.0.zip)

Now you are ready to build WSO2 WSF/PHP extension from source.

Unzip the wso2-wsf-php-src-1.1.0.zip file to your prefered location. I use E:\wso2-wsf-php-src-1.1.0 as an example. In this folder you will find a configure.in file which is used to specify the configuration parameters to build WSF/PHP.

In the configure.in file you will find entries for specifing the locations of the
WSF/PHP dependencies. Here is the configure.in file shiped with WSF/PHP.

###################################
### General Build Configuration Parameters

# To build with debug symbols set DEBUG = 1
DEBUG = 1

###################################
### Apache Axis2/C Build Configuration Parameters

# Path to libxml2 installation
LIBXML2_BIN_DIR = E:\libxml2-2.6.27.win32

# Path to iconv installation
ICONV_BIN_DIR = E:\iconv-1.9.2.win32

# Path to zlib installation
ZLIB_BIN_DIR=E:\zlib-1.2.3.win32

# Path to Apache2 installation
APACHE_BIN_DIR = "E:\Apache22"
# Apache httpd version, to use apache 2.0.x set APACHE_VERSION_2_0_X = 1
APACHE_VERSION_2_0_X = 0

# Enable/disable LibCurl client transport, to enable set ENABLE_LIBCURL = 1
ENABLE_LIBCURL = 0
# Path to LibCurl installation, required if LibCurl transport is enabled
#LIBCURL_BIN_DIR = E:\libcurl-7.15.1-msvc-win32-ssl-0.9.8a-zlib-1.2.3

# Enable/disable SSL client transport, to enable set ENABLE_SSL = 1
ENABLE_SSL = 1
# Path to OpenSSL installation, required if SSL transport is enabled
#OPENSSL_BIN_DIR = D:\OpenSSL

# Enable/disable Guththila parser, to enable set ENABLE_GUTHTHILA = 1
ENABLE_GUTHTHILA = 0


############################
### Apache Rampart/C Build Configuration Parameters

# Path to OpenSSL installation
OPENSSL_BIN_DIR = E:\OpenSSL


############################
### Apache Sandesha2/C Build Configuration Parameters

# Build with SQLite support for permanent storage, to disable set WITH_SQLITE = 0
WITH_SQLITE = 1
# Path to SQLite installation
SQLITE_BIN_DIR = "E:\sqlite-source-3_3_8"
# Path to SQLite source
SQLITE_SRC_DIR = "E:\sqlite-source-3_3_8"

# Build with MySQL support for permanent storage, to enable set WITH_MYSQL = 1
WITH_MYSQL = 0
# Path to MySQL installation
MYSQL_BIN_DIR = "C:\Program Files\MySQL\MySQL Server 5.0"

############################
# Configuration for building wsf/php extension using its own build
PHP_SRC_DIR = E:\php\php-5.2.4
PHP_BIN_DIR = E:\php\php-5.2.4-Win32
WIN32BUILD_DIR = E:\php\win32buil

As you can see , specifing the Dependencies is very simple.
Next step is to run the build.bat file located in the wso2-wsf-php-src-1.1.0 directory. It will build the binary distribution to a folder named wso2-wsf-php-bin-1.1.0-win32 directory.

Thats it.