Link to home
Start Free TrialLog in
Avatar of matthew016
matthew016Flag for Belgium

asked on

PHP <> J2ee

Hi,

I am using JSP when developing web applications, and learning PHP.
In my j2ee based web applications, I have usually an "application configuration" ,
which is an xml file that defines some constants for my web applications.
I have then a start-on-load servlet, which is a thread that is running when the web application starts,
and is reading this xml file and put the constant in memory (static variables).

I wonder how we can do such things in PHP ... since I can't see anything about threads.

Another example would be a user making a request that takes a very long time for the application,
in JSP i would launch a new thread, so that user don't have to wait this long process,
but in PHP this isn't possible.

A last example :
I have a chat server and I want to display on my website the status of this chat server
(on / off / number of connected / etc.)
In JSP it is quite simple, I could launch a thread, which is querying every X seconds the chat server,
and change some constants in the web application. In my .jsp pages, for each user request (user thread) I just read the constants and display them.
How could I do such a thing in PHP ?

Thak u for any comment.
ASKER CERTIFIED SOLUTION
Avatar of Roonaan
Roonaan
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of matthew016

ASKER

Thank u Roonaan for clarifying.

Ok I see, in a j2ee environment the threads are running in the Java Virtual Machine (JVM) of the web application, which means that each thread has access to the other classes instantiated within this JVM.

In PHP, each user request is also a thread ? Or how is this called in the PHP world ? How are each user request processed ?

How could I combine the two technologies,
for example for this chat monitor, if I write it in a servlet or a standard Java class,
I have no idea on how to interact   PHP - Java   technology.
Using php5 you can communicate (from code) with java depending on your setup. I have not worked with application servers capable of doing so (yet), so I am not familiar with the subject. I am in the process of gathering information on the subject, but haven't got a structured view at this stage.

This article might be interesting for you as well: http://dev2dev.bea.com/pub/a/2007/02/php-java-bridge.html

-r-