473,473 Members | 2,031 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

PHP Application Server

Hi people,
I'm developing the first PHP Application Server.
It can run PHP classes that extends the HttpPhplet interface with the same
methods of javax.http.HttpServlet.
The phplet are like servlet, they runs into a container and implements
init(), service(), destroy() methods.
It's a brand new concept for PHP, but we have a solid experience with java
servlets and the idea behind this (a web application with a servlet complete
lifecycle) it's a valid one.
The first releases of Phplet Application Server are already avaible for
download! I placed the project into public domain at
http://phplet.sourceforge.net .
Of course every experienced PHP developer is invited to join the project.
Jul 17 '05 #1
3 2747
Actually, it already exists: SRM (Script Running Machine). The project
was started by Derick Rethans and as I know of, he's currently working
on a PHP 5 version.

Luca Mariano wrote:
Hi people,
I'm developing the first PHP Application Server.
It can run PHP classes that extends the HttpPhplet interface with the same
methods of javax.http.HttpServlet.
The phplet are like servlet, they runs into a container and implements
init(), service(), destroy() methods.
It's a brand new concept for PHP, but we have a solid experience with java
servlets and the idea behind this (a web application with a servlet complete
lifecycle) it's a valid one.
The first releases of Phplet Application Server are already avaible for
download! I placed the project into public domain at
http://phplet.sourceforge.net .
Of course every experienced PHP developer is invited to join the project.


Jul 17 '05 #2
Louis-Philippe Huberdeau <lp*********@sympatico.ca> schrieb:
Actually, it already exists: SRM (Script Running Machine). The project
was started by Derick Rethans and as I know of, he's currently working
on a PHP 5 version.


That would be fine. There's no status update on his website since last
year. *sigh*

Regards,
Matthias
Jul 17 '05 #3
Matthias Esken ha scritto nel messaggio ...
Louis-Philippe Huberdeau <lp*********@sympatico.ca> schrieb:
Actually, it already exists: SRM (Script Running Machine). The project
was started by Derick Rethans and as I know of, he's currently working
on a PHP 5 version.


That would be fine. There's no status update on his website since last
year. *sigh*

Regards,
Matthias


Thanks for the reference to this interesting project, I had a look to it
but I must correct Louis-Philippe...
SRM is a totally different project, since it aims to tier the PHP webapp
running cycle into more than one level (web server - SRM - browser). It uses
a C daemon, while my project is entirely written in PHP.
My approach to the problem "writing an application server for PHP" is quite
simpliest.
I'm simply writing in PHP an AP similar to Tomcat:
- tomcat is written in Java and serves servlet
- phplet is written in PHP and serves phplet.
From an user (developer) point of view this have many advantages, because
the persistence is not limited to single
objects that we're going to store into a container, but is extended to the
whole servlet context.
In poor words, a phplet must have a behaviour similar to a servlet; at the
bottom of this msg I attached the code for a simple web application that
reads the table defined into a given DB (for the moment).
You can see that phplet philosophy match exactly servlet one; into the
init() method you initialize all objects that will be useful; into the
service() method you receive a Request object from the container, make your
PHP stuff (exactly like all PHP scripts), then fill the Response with
output; the destroy() method is executed at container shutdown.
It's just like tomcat does...

<?php
/**
* A replacement for phpMyAdmin
* @author Luca Mariano <lu**********@email.it>
*/
require_once 'DB.php';
require_once 'HTML/Table.php';

DEFINE ('DNS', 'mysql://user:pa**@127.0.0.1/database');

class dbManager extends HttpPhplet {
var $initTime;
var $dbObj; // the PEAR::DB object used to manipulate DB
var $tables; // [array] list of tables into this database
var $_errors;

function init(&$config)
{
$this->initTime = gmdate("D, d M Y H:i:s T");
$this->tables = array();
$this->_dbConnect();
}

function service(&$request, &$response)
{
switch ($request->getParameter("action")) {
case "showtables":
$response->write($this->_showTables());
break;
case "tablestructure":
$response->write("TO DO");
break;
case "tablecontent":
$response->write("TO DO");
break;
default:
$response->write("Unsupported request.");
}
}

function destroy()
{
$this->dbObj->disconnect();
}

function _dbConnect()
{
$this->dbObj = &DB::connect(DNS);
if (DB::isError($this->dbObj)) {
$this->_errors[] = $this->dbObj->getMessage();
return false;
}
return true;
}

function _showTables()
{
if (count($this->tables) == 0) {
$this->_getTables();
}

if (count($this->_errors) > 0 && count($this->tables) == 0)
return print_r($this->_errors, true);

$table = new HTML_Table();

for($i = 0; $i < count($this->tables); $i++) {
$table->setCellContents($i, 0, $this->tables[$i]);
}
$table->setAutoGrow(true);
$table->setHeaderContents(0, 0, "Tables");
$altRow = array("bgcolor" => "lightblue");
$table->altRowAttributes(1, null, $altRow);

return $table->toHTML();
}

function _getTables()
{
$conn = true;
if (!DB::isConnection($this->dbObj)) {
$conn = $this->_dbConnect();
}
if ($conn) {
$result = $this->dbObj->query("SHOW TABLES");
// Always check that $result is not an error
if (DB::isError($result)) {
$this->_errors[] = $result->getMessage();
} while ($row = $result->fetchRow()) {
$this->tables[] = $row[0];
}
$result->free();
}
}
}

Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

33
by: aa | last post by:
I am migrating to PHP from ASP where there are the Application Scope variables which are accessible from any page on a website and which are used, in particular, for hit counters. Is there a similar...
3
by: ^CeFoS^ | last post by:
Hi to everybody, due to I want to use the serial port of a server machine through an applet allocated in html document. > Then one application will run in the server machine and using > the serial...
5
by: Matt | last post by:
I think this is the basic concept in ASP server-side development. My boss told me web application is NOT client-server application. I argued with him because browser is the client, and the server...
3
by: Varkey | last post by:
Dear friends, I am new to .NET based app development and have a pretty elementary query, I suppose... I have caught up with the basics of .NET pretty well, thanks to some Microsoft VB/ASP...
43
by: Davey | last post by:
I am planning on developing an application which will involve skills that I have very little experience of - therefore I would appreciate comments on my initial design thoughts. Overview on...
9
by: Wayne Wengert | last post by:
I built an ASP application and it runs fine on my local IIS. I am trying to move the application to my web service (ISP) out on the internet. I've read several of the help articles but they all...
21
by: Chris | last post by:
I'm trying to get an existing VS.NET project up on my Win2003 server and I get the following error (on the actual website page): "It is an error to use a section registered as...
17
by: Timothy.Rybak | last post by:
Hello all, This is my first attempt at an application, so kid gloves are appreciated. I need to make a very simple form that only has a few elements. One is TraceCode - a text field that is...
13
by: Kevin Liebowicz | last post by:
Yes, I wasted the past two days trying to fix this. Yes, this is on a Win2003 Server. Yes, this machine is a domain controller. Yes, I seen the dozens of KB articles like this one:...
6
by: Tony Johansson | last post by:
Hello! We have a C#.ASP.NET application that runs on a IIS 6. The application contains actually several asp pages but there is no GUI. The application receive an xml file that is processed....
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.