note 40208 added to ref.java
| From: | Thomas at rn2 dot php dot net | Date: | Wed, 25 Feb 2004 12:44:51 +0000 |
| Subject: | note 40208 added to ref.java | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-65705@lists.php.net to get a copy of this message | ||
The documentation is missing an important note:
The PHP/JAVA bridge only works on threaded http servers such as IIS, it does NOT work on http
servers such as APACHE which fork off (sub-)processes.
The reason for this is that for each new request APACHE fork()'s off a new and independed copy
of itself, initializes the java VM and eventually passes control over to VM until the request is
finished. If the request is finished, the child with the java VM go to the apache pool.
That means that after a while hundreds (up to MAX-PROCESSES) of java VM's are in the apache
pool each of them eating away up to 64MB. The machine may sooner or later crash because it ran out
of memory. (If you have luck, the bridge will not run at all because apache was not statically
linked to the pthreads library).
Although another PHP/Java bridge exists that does not have this problem (do a google search for
"A new PHP/JAVA module"), the java binding (used by both bridges) has also problems one
must be aware of. For example if one creates a Properties() object, one will receive a reference to
it and may ask this reference for its values. However, if one invokes a method that returns a
Properties() object, one will receive an array of values, not a reference to the Properties()
object.
In short: If you want to use java from php in IIS, you can use this bridge. BUT if you want to use
java from php in APACHE, you must use a socket approach (for an example see "A new PHP/JAVA
module").
----
Manual Page -- http://www.php.net/manual/en/ref.java.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+40208
Delete -- http://master.php.net/manage/user-notes.php?action=delete+40208&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+40208&report=yes
Search -- http://master.php.net/manage/user-notes.php