Re: [PHP-DEV] persistent java virtual machine under PHP
This is contrary to my experiences. But we have discussed this earlier today. After reviewing the thread, I think the problem you are experiencing is related to the fact that each instance of PHP is running a seperate JVM. It's not that the JVM is being destroyed. Therefore when you have apache running with say 5 httpd children, you will be running 5 seperate JVM's each with it's own environment. So if you tried to keep a Java variable active from request to request, it would disappear once your apache KeepAliveTimeout was up. Does that sound about right? -Tony -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Java Extension Build Method
Under the heading Build java module with -ljava you mention that there were crashing problems because libjava.so was linked agains pthread and apache wasn't. This is not uncommon problem for other libraries such as oci8. You can link apache with pthread which will prevent the segfaults. See oci8 manual page for instructions. Thanks for the tip. I built apache with -lpthread and I was able to get a little bit farther with linking the java module with -ljava.For the first time I was able to run the following script through apache: http://www.tjw.org/php_java/classloader.phps However, I had other problems that keep this build method from working right. The code $system = new Java('java.lang.System'); would hang apache. Why the more advanced classloader.php example worked and this one didn't I have no idea. Both examples worked fine in the CLI build of PHP. I also noticed that if i create the JVM in PHP_MINIT_FUNCTION() instead of creating it on the first request for java, apache hangs for every java request. This works fine in the CLI build. Since I get no segfault and strace -p gives me no output at all, I'm stumped. -Tony -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Java extension fixes
On Wed, 4 Dec 2002, Ray Hunter wrote: Will this fix the errors that occur with running PHP as a servlet in tomcat? Basically, if you were using ini_set() anywhere, or using .htaccess files to change any php settings, this patch should prevent errors/crashing. -Tony -- Ray On Wed, 2002-12-04 at 01:20, Sebastian Bergmann wrote: Tony J. White wrote: Can someone please add this to CVS or should I contact Sam Ruby (the orignal author) to do it? Committed, Sebastian -- Sebastian Bergmann http://sebastian-bergmann.de/ http://phpOpenTracker.de/ Did I help you? Consider a gift: http://wishlist.sebastian-bergmann.de/ -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] persistent java virtual machine under PHP
On Wed, 4 Dec 2002, [ISO-8859-2] Maróy Ákos wrote: What happens is that the function jvm_create() gets called regularly when requesting new pages using the Java extension, from the function java_call_function_handler(): if (!JG(jenv)) jvm_create(TSRMLS_C); Actually, the JVM is unloaded by php. In the latest CVS the code from destroy_jvm() has been removed that tried to dlclose() the JVM. This was done because it is impossible to dlclose() a JVM because DestroyJavaVM() is broken in all JNI implementations. It the code you reference JG(env) is a global variable that is the jenv of the currently running JVM. Of course a new JVM needs to be created by every instance of PHP (so every httpd child in apache). The code is misleading because in past versions of PHP, the module tried to unload the JVM and load it again every time a ini setting was changed. This code should be removed and jvm_create() should be instead placed in the PHP_MINIT() function, that way the JVM will be loaded when apache is started instead of the first time java() is used by PHP. I'll get to it eventually unless someone beats me to it. -Tony -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Java Extension Build Method
The /ext/java module is an odd duck compared to other php extentions in that it uses DL_LOAD() to load libjava instead of being linked and that it is always built as a module (.so) instead of being built static into php. I've spent some time over the past couple weeks investigating why this is done and experimenting with different build methods. Although, i haven't come up with any breakthroughs in makeing the java extension build any other way, I've compiled some notes on the subject: http://tjw.org/php_java/build_notes.php I think I have a pretty good handle on why things are the way they are, but am I missing something? -Tony -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] sapi/servlet configuration error
On Thu, 5 Dec 2002, Ray Hunter wrote: make: *** No rule to make target `sapi/servlet/java.c', needed by `sapi/servlet/java.lo'. Stop. It looks like the sapi/servlet/Makefile.frag is not being added to your Makefile. Can you verify that there is no line in your main Makefile that starts with sapi/servlet/java.c : ? Perhaps you could try changing the line (from sapi/servlet/config.m4) PHP_ADD_MAKEFILE_FRAGMENT(sapi/servlet/Makefile.frag) to just PHP_ADD_MAKEFILE_FRAGMENT In case $ext_srcdir is something other than 'sapi/servlet' for some reason. -Tony -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] sapi/servlet configuration error
On Thu, 5 Dec 2002, Ray Hunter wrote: This is the line in my Makefile: sapi/servlet/java.lo: sapi/servlet/java.c $(LIBTOOL) --mode=compile $(CC) -Isapi/servlet/ -I/home/rhunter/src/php4/sapi/servlet/ $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) -prefer-pic -c sapi/servlet/java.c -o sapi/servlet/java.lo Is that correct? That chunk is added by the macro PHP_ADD_SOURCES() in sapi/servlet/config.m4. If there is no line that _starts_ with 'sapi/servlet/java.c :', then the sapi/servlet/Makefile.frag is not being included properly. If it's not, try changing the PHP_ADD_MAKEFILE_FRAGMENT like I indicated, then run: make clean rm -r configure autom4te.cache ./buildconf ./configure --with... make You will need to have installed the required packages to do this though (e.g. automake, autoconfig, etc. ) -Tony -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Java extension fixes
I think the reason DL_ERROR is defined in java.c for win32 platforms is that there is no dlerror() function for win32. I'm only guessing because I have no win32 platform to test on. On unix platforms, DL_ERROR is defined in zend.h as the function name for the dlerror() equivalent. Can someone verify that there is a dlerror() function for win32? Here is the current code from java.c #ifdef PHP_WIN32 #include win32/winutil.h #define DL_ERROR php_win_err #endif -Tony On Mon, 25 Nov 2002, Dan Kalowsky wrote: Comments on the patch. Don't redefine DL_ERROR, this should already be defined by the ZEND engine, but just check to make sure ;) All of your build problems are known problems. If you can fix them, excellent! Just wondering if this has been tested against windows where the most prevalent errors seem to be the improper loading/unloading of the JVM. On Monday, November 25, 2002, at 01:00 AM, Tony J. White wrote: I'm made a stability fix to the PHP Java extension. A full description of the changes as well as the updated java.c file (and patch) can be found here: http://tjw.org/php_java/ Can someone please add this to CVS or should I contact Sam Ruby (the orignal author) to do it? -Tony -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php --- Dan KalowskyMomma take this badge offa me, http://www.deadmime.org/~dankI can't use it anymore. [EMAIL PROTECTED]- Knockin on Heavens Door, [EMAIL PROTECTED]Bob Dylan -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] CVS Account Request: tjw
Submit fixes for php4/ext/java/ only. Rasmus instructed me to fill out this form. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Java extension fixes
I'm made a stability fix to the PHP Java extension. A full description of the changes as well as the updated java.c file (and patch) can be found here: http://tjw.org/php_java/ Can someone please add this to CVS or should I contact Sam Ruby (the orignal author) to do it? -Tony -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php