|
Posted by Bjarne on 01/17/07 14:20
Dear all,
although being a user of PHP and other scripting-languages for years, I
have not taken part in any large projects based on PHP. Thus, I don't
really know how real PHP-applications are deployed out there. This
posting is a request for input from professional PHP-users and
architects with experience from designing PHP applications.
My company makes a toolkit for developing WebServices. This toolkit is
typically used to expose an API to existing applications. i.e. exposing
(parts of) an existing application as a WebService. The server-part of
this toolkit is implemented in Java and currently requires the
user-application also to be implemented in Java (running inside a
container of the users choice or standalone, if desired). The toolkit
can generate client-code for PHP - see http://www.smodl.org/ if you're
interested in more details.
One of our goals is to make the server-part of our toolkit work in a
LAMP stack, allowing the user-application to be written in e.g. PHP.
Running it on a MS platform with IIS and PHP may be a secondary result,
but it is not the primary goal. We would, for obvious reasons, like to
re-use the proven server-part of the toolkit, which is written in Java.
This suggests using some way to bridge PHP and Java. I understand that
such bridges exists, but first there is the question of architecture :
How should these components interact?
These are the three different scenarios we are currently investigating
:
Scenario 1 : Let a servlet-container (e.g. Tomcat) be the front-end of
the WebService, running the toolkit server-part as a servlet. The
servlet would perform toolkit-tasks and then call the appropriate
methods in the user-application written in PHP. I imagine the SAPI
module would handle this. Pro : SAPI seems to be recommended on php.net
as a robust and efficient solution. Con : replacing apache as the
front-end might not be desireable?
Scenario 2 : Let a http-server (e.g. Apache) be the front-end of the
WebService, primarily invoking a PHP-script. This PHP-script would
bridge to the toolkit server-part to perform toolkit-tasks, and then
call the appropriate methods in the user-application. The PHP-Java
bridge should be able to handle this. Pro : Apache remains the
frontend, user-control over the primary entry-point. Con :
availability, stability and performance of the PHP-Java bridge?
Scenario 3 : Let a http-server (e.g. Apache) be the front-end of the
WebService, primarily invoking a cgi-bin. The cgi would essentially
wrap the standalone toolkit server-part which would perform toolkit
tasks and then call the appropriate methods in the user-application
written in PHP. The SAPI module should be able to handle this. Pro :
Apache remains the frontend, SAPI seems to be recommended as robust and
efficient solution on php.net. Con : startup-time?
As briefly indicated above, these scenarios have different pros and
cons. But which one makes most sense and would fit most seamlessly into
your PHP production-environment? Have I possibly missed some obvious
points? Or are there other scenarios which would make more sense?
Thanks in advance for your time!
Best regards,
- Bjarne
[Back to original message]
|