PHP Application Server

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default 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
    [url]http://phplet.sourceforge.net[/url] .
    Of course every experienced PHP developer is invited to join the project.


    Luca Mariano Guest

  2. Similar Questions and Discussions

    1. Can you detail How create an application use StreamingMedia Server (Flash Media Server) for me?
      Can you detail the way to create an application use Streaming Media Server (Flash Media Server) for me? I installed Flash Media Server 2,...
    2. CF MX7 Application Server
      :frown; I am running Windows XP Pro. I have Apache installed which is using port 80 and IIS installed which is using port 90. I wish to use Cold...
    3. Application error in server
      hi: someone has an idea about the cause of this error? it occurs with any ASP page TIA, manuel
    4. Application server help!!
      Hi, I'm new and pratising with PHP and dreamweaver. I have installed IIS webserver and want to use PHP in DMW which says i have to install MySql...
    5. Oracle application server and AIX apache server
      Dears, One of my customer has just installed Oracle application server which automatically install apache server for oracle on aix. It is working...
  3. #2

    Default Re: PHP Application Server

    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
    > [url]http://phplet.sourceforge.net[/url] .
    > Of course every experienced PHP developer is invited to join the project.
    >
    >
    Louis-Philippe Huberdeau Guest

  4. #3

    Default Re: PHP Application Server

    Louis-Philippe Huberdeau <lphuberdeau@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
    Matthias Esken Guest

  5. #4

    Default Re: PHP Application Server

    Matthias Esken ha scritto nel messaggio ...
    >Louis-Philippe Huberdeau <lphuberdeau@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 <luca.mariano@email.it>
    */
    require_once 'DB.php';
    require_once 'HTML/Table.php';

    DEFINE ('DNS', 'mysql://user:pass@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();
    }
    }
    }



    Luca Mariano Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139