WSF/PHP from the scratch.

This post might be helpful for beginners like me whereas might not be anything for experts :) . In this post I'm explaining steps to install WSF/PHP on Debian based systems. (Yes , it might be helpful for Ubuntu users too). Today for the first time I installed WSF/PHP on my Debian (sid) operating system on my own. On the way I came across some problems that I thought to write in this post because it will help you to avoid them.

Steps

  1. Install Apache2
  2. Install PHP5
  3. Install libapache2_mod_php5
  4. Get php working with Apache2.
  5. Download and install WSF/PHP
  6. Configure WSF/PHP
  7. Run service (echo_service.php)
  8. Run client (echo_client.php)

1. Install Apache2.

On a debian based system this is quite simple with apt. Therefore user could do this in one step.

#apt-get install apache2 php5 libapache2-mod-php5

with this one line we are done with 1,2 and 3 steps straight away.

4. Get php working with Apache2.

It is important to note that your configuration files placed under /etc. In debian system your apache2 webroot is located at /var/www/, I tried this test.php script just to confirm my installation.

<?php phpinfo() ?>

Placed it /var/www/test.php and open http://localhost/test.php in the web browser. Unfortunately it didn't work for me first time :(. After some time I figured out that I didn't have following entries in /etc/apache2/apache2.conf


LoadModule php5_module "/usr/lib/apache2/modules/libphp5.so"
AddType application/x-httpd-php .php
PHPIniDir "/etc/php5/apache2/"

After having those entries in /etc/apache2/apache.conf , I was able to run http://localhost/test.php script on my machine.

5. Download and install WSF/PHP.

Since I'm using debian based system, I used wsf/php deb file. You can download it from here [link]


# dpkg -i wso2-wsf-php-1.2.0-debian.deb
# apt-get install php5-xsl

NOTE:

wsf-php has a dependency on php5-xsl for its wsdl generation.

6. Configuring WSF/PHP.

For me this was a quit a task.
in /etc/php5/apache2/php.ini file I had following entries ,
here "/usr/lib/php5/20060613+lfs/" is my php extension directory, your value may be different.


include_path = ".:/usr/share/php:/usr/lib/php5/20060613+lfs/wsf_php/scripts"

extension=wsf.so
extension=xsl.so
wsf.home="/usr/lib/php5/20060613+lfs/wsf_c"
wsf.log_path="/tmp"
wsf.rm_db_dir="/tmp"

then I created directory named "sand" in /var/www/ just to have samples and scripts there. All the samples from extension directory , copied to /var/www/sand


#cp /usr/lib/php5/20060613+lfs/wsf_php/* /var/www/sand/ -rf

If you need more information on above values this article [link] might be helpful.

7. Run service.

I choose echo_service.php to run first. Opened following url in the browser http://localhost/sand/samples/echo_service.php
Then it showed echo_service.php under the deployed services.

8. Run client.

Before run the echo_client.php, made a little modification. Opened /var/www/sand/samples/echo_client.php and modified

 
$client = new WSClient(array( "to" =&gt; "http://localhost/samples/echo_service.php" ));
 
to 
 
$client = new WSClient(array( "to" =&gt; "http://localhost/sand/samples/echo_service.php" ));

because I placed samples under "sand" directory. Then opened
http://localhost/sand/samples/echo_client.php in the browser and got echo response.

Summery

In this post , I thought to give more easy , simple and specific approach to install WSF/PHP on your debian based systems, avoiding problems that I came across during my installation.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Netvouz
  • Wists
  • blogmarks
  • Furl
  • Reddit
  • StumbleUpon
  • Technorati
  • YahooMyWeb