RE: [PHP4BETA] JSP vs. PHP - Two vs. Three Teir

From: Date: Thu, 06 Apr 2000 19:53:33 +0000
Subject: RE: [PHP4BETA] JSP vs. PHP - Two vs. Three Teir
Groups: php.version4 
Request: Send a blank email to php-version4+get-13248@lists.php.net to get a copy of this message
Michael Nino wrote: > > Thank you for the clarification. How reliable is PHP as a servlet? You tell me. I'm the author, so I'm a bit biased... > What is the recommended JVM for this? My experience is with Windows and Linux. I would recommend either the Blackdown 1.2.2 RC4 for Linux or the Sun 1.2.2 for Windows or the IBM JDK 1.1.8 for either platform. > Is there a HOW-TO available? There is a README with examples. I'm working on HTML documentation now. > In regards, to PHP functioning as a daemon or service to other PHP scripts, > can you think of any way this might be implemented? With what you have available today, you would access PHP another tier via HTTP. Typically, this would entail logic like foreach (file("http://server/request.php?arg=$value") as $line) { /* parse line */ } I consider parsing typical output of an HTTP request error prone and suboptimal. An improvement over this to format and parse this data as XML. If a multi-tier design is fundamental to your architecture, I would look into xml-cocoon on xml.apache.org to do this. It is way too much conceptual overhead for the typical shopping cart type of web application, but it may be exactly what you need. I've promised myself that next month I will work on integrating PHP with BSF (http://alphaworks.ibm.com/tech/bsf) and BSF with cocoon. Contained in cocoon is a generator which allows you to imbed logic into your XML pages. BSF enabling cocoon would allow this logic to be written in your choice of scripting languages. Enabling BSF to script PHP would make PHP one of the available choices. At this point, I've completed the circle. > How does PHP as a servlet work? I'm not sure I understand this question. I mean: request comes in and response goes out - that's pretty much all there is too it. You can run existing PHP pages unmodified - simply place them where the web server can find them and make sure that they are named in such a way that the web server knows that they are in fact PHP (typically this means naming the file with the extension of PHP). When run as a servlet, ext/java is built in - so you have full access to all the Java goodies. Additionally, PHP servlets have access to the $request and $response objects, so you can pretty much do anything a servlet can. - Sam Ruby

« previous php.version4 (#13248) next »