From: [EMAIL PROTECTED]
Operating system: Linux
PHP version: 4.0.6
PHP Bug Type: Feature/Change Request
Bug description: better sapi/servlet support
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");
$start=$system->currentTimeMillis();
$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>
<?
}
$rs->close();
$stmt->close();
$conn->close();
$end=$system->currentTimeMillis();
?>
<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.
--
Edit Bug report at: http://bugs.php.net/?id=11930&edit=1
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]