|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11930 better sapi/servlet support
Submitted: 2001-07-06 08:27 UTC Modified: 2002-02-24 06:11 UTC
From: daniel dot dadusc at yoda dot it Assigned:
Status: Not a bug Package: Java related
PHP Version: 4.0.6 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: daniel dot dadusc at yoda dot it
New email:
PHP Version: OS:


 [2001-07-06 08:27 UTC] daniel dot dadusc at yoda dot it
I think that better java and sapi/servlet support are essential for the success of php in the ENTERPRISE environment. PHP is great at what it does, unfortunately is what not designed in mind with high reliability and scalability in mind. The j2ee platform defined on the other hand is, and already has many commercial implementations (Weblogic, Ipass, etc...) . Writing business logic, and handling critical resources is done better by java, but java solutions for easy dynamic web page creation such as jsp are horrid compared to php. Using sapi servlet under resin 2.0.0 i was able to get this code to run (albeit after only a few page views the sapi made the servlet runner crash):

    $system = new Java("java.lang.System");
    $context = new Java("javax.naming.InitialContext");
    $ds = $context->lookup("java:comp/env/jdbc/manhattan");
    $conn = $ds->getConnection();
    $stmt = $conn->createStatement();
    $rs = $stmt->executeQuery("select team_name from team");
    while ($rs->next()) {
        Team name <?=$rs->getString(1)?><br>
    <br>Time taken: <?=$end-$start?>

The example demonstrates a simple benchmark for a random query on one of my databases. The performance btw, was around 400ms, which in my opinion is unacceptably slow. This example while crude, does help show the potential of better sapi/servlet support. It will really get exciting once we see wider distribution of ejb 2.0 technology which would allow code like this to be run (even though the following example is fictitious, i have tested the ejb 2.0 tech and i know it works):

// The JNDI context containing EJBs
$context = new Java("javax.naming.InitialContext");

// get the home interface for the team cmp (container managed persistence) ejb
$team_home = $context.lookup("java:comp/env/cmp/squadra");

// call a standard finder method from the home interface which returns a java Collection of teams
$teams = $team->findAll();
while ($teams->hasNext()) {
$team = $teams->next();
echo "Team Name ". $team->getTeamName() ."<br>";

With the all the database work abstracted by EJB it can be seen that the merging of php and java enables some incredibly elegant and efficient code to be written. Better sapi/servlet will allow this to happen. 

p.s. I'm not sure about this, but it may also help it if a native CORBA support is implemented by php. It may be possible to call the rmi.RemotePortableObject.narrow() through the java interface but i'm not sure how efficient that would be anyway.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-02-24 06:11 UTC]
I'll make this bogus.
Could you submit short version as Feature request? (if you want)
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 12 21:01:30 2024 UTC