?
Solved

PHP  <>  J2ee

Posted on 2007-04-10
3
Medium Priority
?
462 Views
Last Modified: 2010-08-05
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.
0
Comment
Question by:matthew016
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 49

Accepted Solution

by:
Roonaan earned 2000 total points
ID: 18880984
Each php call is processed on its own. There is no shared memory. you can just define your constants in a config.php file which is called on each script execution.

You might be interested in viewing php/java as two parts working together rather than competitive technologies. Using java from php and php from java and using the best from both technologies.

There should be no reason to not keep your chat server status monitor as java, while running the rest of your website on php.
0
 
LVL 9

Author Comment

by:matthew016
ID: 18881028
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.
0
 
LVL 49

Expert Comment

by:Roonaan
ID: 18881044
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-
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question