Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

Wednesday, October 15, 2008

How to build PHP from source

It is an interesting thing to build PHP source on a Windows Platform. It is extremely useful to build PHP source with various options specially if you wish to write a php extension. Here are some interesting tips on how you can build PHP source on a windows platform.

First you need to download the following dependencies.

1. You need to have visual studio or windows platform SDK install on you machine in order to have the required compiler and build tools.

2. You need to download the PHP build dependencies.

These include

1. Binary tools - Essential

2. Libxml2   - Optional

3. Iconv Optional

4. Zlib   - Optional

5. Apache or other web server that you intend to build modules.

6. PHP Source  - Essential

7. bindlib-cvs-vc8  - Essential

 

Most of these tools can be downloaded from here.

Once you have downloaded these tools, you are ready to build PHP from source.

First unzip all these tools to a directory. 

img1

Next, open visual studio command prompt and add binary-tools\bin directory to the path.

img2

Now, go to the PHP source extract directory and type,

buildconf.bat

Then run

cscript /nologo configure.js --help

img3

You will see a large number of options as shown above.

Next open the config.nice.bat file located in the php source directory and add necessary configure options for your build

Here are my configuration options

cscript /nologo configure.js  "--with-extra-includes=E:\phpbuild\bindlib-cvs-vc8\include;E:\Apache22\include;E:\phpbuild\iconv-1.9.2.win32\include;E:\phpbuild\libxml2-2.6.30.win32\include;E:\phpbuild\zlib-1.2.3.win32\include"

"--with-extra-libs=E:\phpbuild\iconv-1.9.2.win32\lib;E:\phpbuild\libxml2-2.6.30.win32\lib;E:\phpbuild\zlib-1.2.3.win32\lib;E:\Apache22\lib;E:\phpbuild\bindlib-cvs-vc8\lib"

"--enable-debug"  "--enable-apache2-2handler" %*

 

Here I am using the option --with-extra-includes to specify the include paths of the dependency libraries.  Similarly --with-extra-libs is used to specify the library path.

I use the options --enable-debug to make it a debug build.

Now run config.nice.bat file.

Next you can try nmake on the command line  and it will build the PHP Source.

Thursday, July 31, 2008

New features to be released with WSF/PHP

Since the 1.3.2 release of WSF/PHP, a lot of new functionality has been added to the extension. In addition to that many bugs have been corrected. Following are some of the new features that will be released with the next release.

Improved MTOM/SwA attachment support

One of the limitations of WSF/PHP attachment support was that the service was not handling the http chunked messages. Also there was a limitation on the size of the attachment that can be received by the service.

We have recently fixed this issue. Now both the client and service is able to send binary attachments as chunked. Also with this addition, a service can receive an attachment of any size.

Another limitation we had was that, it was necessary to read the binary file to memory and then set it with the attachments array in order to send an attachment. Now if the file if a large file, this would require a large amount of memory. Now you can set provide the filename and enable caching in order to send the attachment in a memory efficient way.

PKCS12 Key Store support.

This was one of the essential features for implementing WS-Security. Since a access restricted service would want to provide its functionality to a limited number of previously specified clients, it should have the ability to keep track of the clients public certificates in addition to its private in in a single file. This functionality has been added to WSF/PHP.

Improved REST Support

It is quite handy to have the ability to expose you service operations as a REST operation in addition to having it as a soap operation. Now WSF/PHP allows you to map you operations to URL and a HTTP Method so that you can expose the operation as a REST Style operation as well.

PHP Data Services Solution

This is one of the most interesting solutions we have implemented using WSF/PHP. This provides a easy to use framework for exposing the data in you database tables as Web Services. This is compatible with WSO2 WSAS Data Service solution as well. This comes with the WSDL Generation, A database abstraction layer which allows you to use multiple databases and many more features.

WS-Secure Conversation support.

WSF/PHP is now able to support WS-Secure conversation. WSF/PHP allows you can configure a single service to act as a security token service (STS) in addition to providing the secured operations.

Operation Level Policy support

Now you can configure WS Security polices at Operation level with WSF/PHP.

MTOM Attachment Support for Contract First Web Services

This was one of the things that users have been asking for a while. Because of the simplicity of use, Contract first method is preferred by most users. Now WSF/PHP has the support to send and receive attachments in this mode of operation as well.

Monday, May 26, 2008

WSF/PHP 1.3.0 Released

After quite a bit of improvements to the WSDL support, we are shipping WSF/PHP 1.3.0. In addition to the improvements of WSDL mode, this release comes with the ability to send and receive SwA attachments, http authentication support as well. You can find the complete release note here.

Monday, May 19, 2008

Article on Writing a phpt test case

This article demonstrate how to implement a simple .phpt test case to test your web service.

Monday, May 12, 2008

WSO2 WSF/PHP 1.3.0 Coming

WSF/PHP 1.3.0 will be released this week. We decided to cut down on the number of distributions this time around. In previous releases, we released binary packs which include rmp, deb and bin zip files. We will not be releasing those packs this time around. However if one is interested in creating a binary pack for himself using the source distribution, we are ready to help them. For 1.3.0 release we will have the source packs (zip, tar.gz) ,binary zip package for windows and pecl package.

Tuesday, April 1, 2008

PHP Web Services with IIS

I wrote an small guide to installing WSF/PHP in IIS.

Sunday, March 16, 2008

WSO2 WSF/PHP 1.2.1 Released

WSF/PHP Team is pleased to announce the release of WSF/PHP 1.2.1 release. We focused on improving contract first web services support for this release.Schema types support has been improved in this release. All of the current web services stacks for PHP requires the users to go through the WSDL file and pick up the data types and construct his clients and services accordingly. This is quite a cumbersome task. To make this task easier for the user, WSF/PHP 1.2.1 release includes wsdl2php script which can generate the clients and services for a given WSDL. This is an experimental feature that is still it the testing stage. But we hope that is will make the task of implementing Clients and Services easier than ever before.

Another major problem that was fixed in this release was the large attachment support problem. This was an issue that had propagated in to WSF/PHP from WSF/C. Since the changes in WSF/C attachment handling code, the attachments sending and receiving has been made much more efficient. In addition we were able to fix some documentation errors.  Following is the complete feature list for this release.

1. Client API to consume Web services
      * WSMessage class to handle message level options
      * WSClient class with both one way and two way service invocation support
      * Option of using functions in place of object oriented API with ws_request

2. Service API to provide Web services
      * WSMessage class to handle message level options
      * WSService class with support for both one way and two way operations
      * Option of using functions in place of object oriented API with ws_reply

3. Attachments with MTOM
      * Binary optimized
      * Non-optimized (Base64 binary)

4. WS-Addressing
      * Version 1.0
      * Submission

5. WS-Security
      * UsernameToken and Timestamp
      * Encryption
      * Signing
      * WS-SecurityPolicy based configuration

6. WS-Reliable Messaging
      * Single channel two way reliable messaging

7. WSDL Generation for Server Side
      * WSDL generation based on annotations and function signatures, and
        serving on ?wsdl or ?wsdl2 requests

8. WSDL mode support for both client and server side
      * Write services and client based on a given WSDL
      * WS-Addressing and WS-SecurityPolicy is supported in WSDL mode
9. REST Support
      * Expose a single service script both as SOAP and REST service

10. Provide easy to use classes for common services
      * Consume some well known services such as Yahoo search and Flickr
        and Amazon services using predefined classes

Experimental Features
---------------------

11. wsdl2php.php script. This script can generate PHP classes for services
    and clients for a given WSDL to be used with WSDL Mode .

We welcome you you try out this latest release. You can download it from here.

Wednesday, January 9, 2008

Deploying PHP Web Services using XAMPP for windows

XAMPP is one of the most popular Apache destribution containing Apache, MySql , PHP and PERL. Now it is possible to deploy web services on XAMPP using WSF/PHP extension.

All you need to do is to download WSF/PHP 1.2.0 Win32 Binary release and do the following configuration steps.

1. Unzip the binary package. You will get the directory C:\wso2-wsf-php-bin-1.2.0-win32.
Add C:\wso2-wsf-php-bin-1.2.0-win32\lib directory to PATH environment variable.
( assuming that you unpacked the binary zip to C drive )

2. Copy wsf.dll located in wso2-wsf-php-bin-1.2.0-win32 directory to "C:\xampp\php\ext".
(assuming that you have xampp installed on C drive).

3. Edit the php.ini file located in C:\xampp\apache\bin directory and add following php.ini entries.

extension=wsf.dll

wsf.home=C:\wso2-wsf-php-bin-1.2.0-win32\wsf_c
wsf.log_path=C:\wso2-wsf-php-bin-1.2.0-win32\wsf_c\logs
wsf.log_level=3
wsf.rm_db_dir=C:\wso2-wsf-php-bin-1.2.0-win32\wsf_c

Append C:\wso2-wsf-php-bin-1.2.0-win32\scripts to include_path in php.ini as follows.

include_path = ".;\xampp\php\pear\;C:\wso2-wsf-php-bin-1.2.0-win32\scripts\"

Thats it. Now you are ready to try out the samples. So copy the samples directory (C:\wso2-wsf-php-bin-1.2.0-win32\samples) to C:\xampp\htdocs directory.

Now you should be able to run the samples.

Now you can write your own web services and clients using WSF/PHP.