Notice
  • Please enter your DISQUS subdomain in order to use the 'Disqus Comments (for Joomla)' plugin. If you don't have a DISQUS account, register for one here

Core Web Blog

Keep up to date with CoreSolutions

  • Web
  • Posted

WSO2 WSF 2.1.0 Non-Threadsafe Extension for PHP 5.3 on Windows

The WSO2 WSF extension for PHP is a web service extension for PHP and one of the only extensions that we have come across that can handle MTOM web services. Unfortunately, WSO2 no longer supports this extension, which made it very difficult for me recently to obtain a copy of it that is compiled for the non-threadsafe version of PHP that we use with IIS. In the end we had to download the source code from github and recompile it in visual studio.

After having such a hard time trying to find a pre-compiled version of the extension targeting a non-threadsafe platform, I decided to just post some links to the libraries here. Hopefully this will save some time for someone else in the future.

The following are 2 links to download a compiled copy of the non-threadsafe extension, one compiled with VC9, the other with VC10. The compiler version must match the compiler used to build your installation of PHP (if you are using 5.3, it is probably VC9, if you have 5.2 or lower these will probably not work for you).

WSF VC9 non-threadsafe

WSF VC10 non-threadsafe

The following are instructions on how to install the extension:

1. Download and unzip the folder somewhere on your web server. Make note of the path where you unzipped this folder, it contains libraries that the extension uses.

2. Copy the wsf.dll file from the folder into your PHP extensions directory.

3. Open your php.ini file and paste the following code at the bottom (note: make sure that paths are correct)

[PHP_WSF]
extension=wsf.dll
wsf.home="C:/Program Files (x86)/PHP/wso2-wsf-php-bin-2.1.0-win32/wsf_c"
wsf.log_path="C:/Program Files (x86)/PHP/wso2-wsf-php-bin-2.1.0-win32/wsf_c/logs"
wsf.log_level=3
wsf.rm_db_dir="C:/Program Files (x86)/PHP/wso2-wsf-php-bin-2.1.0-win32/wsf_c"
extension=php_xsl.dll
include_path = ".;C:/Program Files (x86)/PHP/wso2-wsf-php-bin-2.1.0-win32/scripts"

4. Add the directory to the wsf_c/lib folder to your server’s path environment variable (e.g. C:\Program Files (x86)\PHP\wso2-wsf-php-bin-2.1.0-win32\wsf_c\lib)

5. Restart your web server

After your web server comes back online, you should see something similar to the following in your phpinfo

wsf phpinfo

The code included in this article was originally developed by WSO2 http://wso2.com and is now available open source at github https://github.com/wso2/wsf

Leave a comment

7 comments

  • Krishna
    Krishna 25 August 2013 Report

    Resolved! It works with our configurations

    Apache 2.4.6 VC9 + PHP 5.3.27 NTS VC9 + PHP as mod_fcgid 2.3.7

    Even though we have the dependencies and the lib folder files in the system path, Apache expects them in the php root folder along with php-cgi.exe while it loads the wsf.dll from ext folder.

    Caveat: Don't overwrite the PHP files (openssl), with openssl dependencies of WSF to avert php crashes.

    However, as said earlier the test in cmd window was OK, as only php comes into play & thus the system path setting was good enough.

    Your Good Efforts! Worth this Exercise.

    Thanks for your prompt response, time & efforts.

    Comment Link

  • Evan Rawson
    Evan Rawson 23 August 2013 Report

    I never tested this extension with an Apache server, however we did nothing to target IIS specifically when compiling the source code.

    Comment Link

  • Krishna
    Krishna 23 August 2013 Report

    An interesting observation:-

    when php.exe -i is run from cmd prompt I could find WSF loaded saying wsf support enabled & version as 2.1.0 & wsf settings etc. and also these wsf_php_server.log & wsf_php_client.log in the WSF Logs dir;

    On the contrary when loaded with Apache 2.4.6 NTS VC9, with same PHP 5.3.27 NTS VC9, wsf is not loading as per the phpinfo. and the error as the same as said earlier

    Could you please highlight the version /build details of your Apache Server that was validated at your end.?

    Thus there should be some conflict with apache libr or modules. Still investigating....

    Comment Link

  • Evan Rawson
    Evan Rawson 22 August 2013 Report

    We use FastCGI on our servers as well, so that is probably not the problem.

    I have the VC9 extension working in PHP 5.3.26. My phpinfo shows Compiler: MSVC9 (Visual C++ 2008)

    Did you add the path to the wsf_c/lib directory to your PATH environment variable? If so, make sure you added it to the System Path variable, not your User Path variable.

    Comment Link

  • Krishna
    Krishna 22 August 2013 Report

    Have rechecked once again. It's not loading in both the following scenarios

    1) Apache 2.4.6 VC9 + PHP 5.3.27 NTS VC9

    2) Apache 2.2.5 VC9 + PHP 5.3.27 NTS VC9

    PHP as mod_fcgid 2.3.7 in both of above scenarios

    Does it expects PHP to be loaded as apache module ??!!!

    But our environment requires it as mod_fcgid only.

    Your valuable Inputs please...

    Comment Link

  • Evan Rawson
    Evan Rawson 22 August 2013 Report

    I haven't tested this on Apache but I see no reason why it shouldn't work. Did you follow the steps outlined in the article? I just realized that step 5 is a little bit ambiguous, by restart the web server I meant restart the entire machine, not just IIS or Apache. You need to restart the whole machine for the environment variable change to take effect. Without that, the extension can't spawn processes from the external libraries in the wsf_c directory that it needs to run.

    Comment Link

  • Krishna
    Krishna 22 August 2013 Report

    Good Efforts! Thanks for sharing your experience.

    BTW, It's not loading with with Apache 2.4.6 vc9/10 builds & nts php vc9/10 builds.

    Is this build exclusive for IIS only & nts php vc9/10 builds?

    Kindly Confirm / Advice back, ASAP.

    Regards

    Comment Link