Re: [PHP] PHP and Java (CVS version)

2001-02-14 Thread Alex Akilov

Evan,

It sounds like your PATH doesn't contain the JDK/bin directory.  What happens if
you type "which jar" at a command shell?

Alex


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] can i install apache php-module AND php-cgi on the same windows-apache?

2001-02-08 Thread Alex Akilov

Sebastian,

I see no reason why you couldn't.  I believe at one time I had CGI, Apache and
Servlet all serving up PHP using different extensions in Apache on Win32.
However, it's been a while so don't hold me to it.

Alex


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Java Servlet Support

2001-02-06 Thread Alex Akilov

"Shawn J. Wallace" wrote:

 That sounds excellent.  So if I understand you correctly, I could run
 Apache with JServ (or Tomcat) and build PHP into it to get a nice
 solution.  I could then write servlets that call PHP scripts/functions and
 vice versa?

You betcha.

Alex


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Is PHP integrated with LDAP?

2001-02-06 Thread Alex Akilov

Zhu George-CZZ010,

There is an LDAP extension in PHP.  Check the manual.

Alex


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Java Servlet Support

2001-02-05 Thread Alex Akilov

Shawn,

The PHP distribution contains various SAPIs (server API's).  Examples
are CGI, Apache, ISAPI, NSAPI and Servlet.  Each of these SAPIs is
optimized to host the PHP interpreter in the respective environment.
Thus, if you want to run PHP in Apache, you can use the Apache SAPI
(also known as mod_php) instead of CGI which will give you much better
performance as well as being able to take advantage of the capabilities
of that API.

The sapi/servlet option is essentially a Java servlet that you add to
your Java webserver just like you would any other servlet and it invokes
the PHP engine through JNI and reflection (so you could reference Java
objects from within your PHP script).  This option is much more
efficient then just running the ext/java extension (which allows you to
access Java objects from PHP by starting up a JVM per session) since the
JVM used is already running in the Java webserver and can be managed
much better by the latter than anything ext/java can attempt to do.
Note that using this SAPI implies that PHP will be running in your Java
Webserver instead of on your HTTP webserver (e.g. Apache) which could
have implications (hopefully for the better) unless they're both running
on the same physical machine.

Let me know if you have other questions.

Alex


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Running java under php4 (PHP4 ext/java)

2001-01-19 Thread Alex Akilov

Fraser MacKenzie wrote:

 Alex, Ok...so far, I have progress.  I have PHP recognizing Java... or at
 least, phpinfo() does.

 Now, when I try to do a new Java("class");

 I get the following error:

 Fatal error: Unable to load Java Library
 
/home/local/java/jdk1.2.2/jre/lib/i386/classic/libjvm.so:/home/local/java/jdk1.2.2/jre/lib/i386/native_threads/libhpi.so:/home/local/java/jdk1.2.2/jre/lib/i386/classic/libjava.so,
 error:
 
/home/local/java/jdk1.2.2/jre/lib/i386/classic/libjvm.so:/home/local/java/jdk1.2.2/jre/lib/i386/native_threads/libhpi.so:/home/local/java/jdk1.2.2/jre/lib/i386/classic/libjava.so:
 cannot
 open shared object file: No such file or directory in
 /home/rondaks_portal/httpd/docs/k2test/index.php3 on line 34

It's really confused since you gave it way too much information.  I'm gonna help you 
clean this up a bit and hopefully explain things a bit so that they make sense.  See 
below.

 Here is the appropriate info from my php.ini file:

 [Java]
 
java.class.path=/home/local/src/php-4.0.4/ext/java/php_java.jar:/home/local/java/jdk1.2.2/jre/lib:/home/local/java/jdk1.2.2/jre/bin

Remove the last two directories as they serve no purpose.  This entry is essentially 
an extension to the system CLASSPATH and should only contain directories and jars that 
contain java classes
or java resource files.

 java.home=/home/local/java/jdk1.2.2/bin:/home/local/java/jdk1.2.2/jre/bin

There should be only one java.home.  It should point at the base directory of the jdk 
(similar to what you specified on the --with-java=... expression).  In this case, use
java.home=/home/local/java/jdk1.2.2

 
java.library.path=/home/local/src/php-4.0.4/ext/java:/home/local/java/jdk1.2.2/jre/lib/i386

This entry is essentially equivalent to LD_LIBRARY_PATH.  Not sure if 
/home/local/src/php-4.0.4/ext/java contains any shared libraries (.so extension).  If 
not, it doesn't belong here.  However,
you should have /usr/local/lib/php/extensions/no-debug-non-zts-20001214 (location of 
libphp_java.so) listed here.  Also, you might also need to list the other directories 
in the JDK that may
contain shared libraries that you need (e.g. 
/home/local/java/jdk1.2.2/jre/lib/i386:/home/local/java/jdk1.2.2/jre/lib/i386/classic:/home/local/java/jdk1.2.2/jre/lib/i386/native_threads).
  A good
way to find out what these are is to go into the 
/home/local/java/jdk1.2.2/jre/lib/i386 directory and run ldd libjava.so and then add 
the directories that contain the shared libraries that
libjava.so depends on to the java.library.path (or LD_LIBRARY_PATH).

 
java.library=/home/local/java/jdk1.2.2/jre/lib/i386/classic/libjvm.so:/home/local/java/jdk1.2.2/jre/lib/i386/native_threads/libhpi.so:/home/local/java/jdk1.2.2/jre/lib/i386/classic/libjava.so

Again, you should only have one entry here and it should simply be the name of the jvm 
shared library (i.e. java.library=libjava.so).  This library will be searched for in 
your LD_LIBRARY_PATH
or java.library.path which you specified above.  Note that on some systems/jdk's you 
might need to specify java.library=libjvm.so.  Specifically, I found I had to do that 
on Solaris or I would
start getting "Cannot locate CreateJavaVM function" errors.

 extension_dir=/usr/local/lib/php/extensions/no-debug-non-zts-20001214
 extension=libphp_java.so

This part looks good.

 Any help you can offer is greatly appreciated.

You're welcome.  Hope this helps.

 Fraser

Alex




Re: [PHP] Running java under php4 (PHP4 ext/java)

2001-01-19 Thread Alex Akilov

Fraser MacKenzie wrote:

 Here is my configuration now:

 [Java]
 java.class.path=/home/local/src/php-4.0.4/ext/java/php_java.jar
 java.home=/home/local/java/jdk1.2.2
 
java.library.path=/usr/local/lib/php/extensions/no-debug-non-zts-20001214:/home/local/java/jdk1.2.2/jre/lib/i386:/home/local/java/jdk1.2.2/jre/lib/i386/classic:/home/local/java/jdk1.2.2/jre/lib/i386/green_threads

Not sure if green_threads are supported by PHP/Java.  Try replacing the green_threads 
specification with native_threads (if your JDK has this subdirectory).  If I recall 
correctly, libhpi.so is in native_threads.
Again, I'd suggest setting LD_LIBRARY_PATH temporarily to what you have up in 
java.library.path (after replacing green_threads with native_threads) and then run ldd 
libjava.so from the command line to see if
everything is found.  BTW, if your JDK doesn't have a native_threads subdirectory then 
you might need to use a different JDK for PHP/Java to work correctly.  Did you ever 
mention what JDK you were using?

 java.library=/home/local/java/jdk1.2.2/jre/lib/i386/libjava.so

Simply use java.library=libjava.so (let it do the search).  However, the above might 
work as is.

Alex


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Running java under php4 (PHP4 ext/java)

2001-01-19 Thread Alex Akilov

Fraser MacKenzie wrote:

 If I don't actually specify the entire path to libjava.so, I get the
 following error:

 Fatal error: Unable to load Java Library libjava.so,
 error: libhpi.so: cannot open shared object file: No such file or
 directory in /home/rondaks_portal/httpd/docs/k2test/index.php3 on line 34

 So, when I actually specify the full path, and change the green_threads to
 native_threads I get the same error.

 This is driving me nuts.

Relax and believe!  We're almost there but you mustn't lose faith.

Let's leave PHP out of things and just figure out your JDK.  Did you try
ldd libjava.so with LD_LIBRARY_PATH set up as I suggested?
Also, does your native_threads directory contain libhpi.so?
Last but not least, mind telling me what JDK you're using?

Alex


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Running java under php4 (PHP4 ext/java)

2001-01-18 Thread Alex Akilov

Eduard and Fraser,

I can try and help you if you list the java section of your php.ini
and indicate what platform you're trying to run on.  Additional
information such as PATH, CLASSPATH and so on would also
help.

Alex


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] ext/java causes segfault in Apache

2001-01-18 Thread Alex Akilov

Brice,

I just checked in some fixes to the ext/java/config.m4.  Are your
changes similar or would you like to share if they're not?

As far as not being able to start JVMs, I suppose it could be
a memory management issue (each JVM is somewhat
resource intensive) so it's rather inefficient to do Java from PHP
in this manner.  I thought you're only supposed to get one JVM
started per session so I'm a bit surprised it's trying to start a new
one each time.

A much better way to run Java in PHP is by using the
PHP/Servlet feature which gives you the same capabilities
but without the JVM management headaches (although there
may be other headaches/bugs in PHP/Servlet that may cause
failures after a few attempts as well, which I'm currently
investigating).  The caveat is that you'll need a Servlet capable
web server such as Tomcat or JServ plugged into your Apache.

Alex


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Problem with PHP using Java Classes

2001-01-18 Thread Alex Akilov

Fraser,

extension_dir=/usr/local/lib/php/extensions/no-debug-non-zts-20001214:/home/local/java/jdk1.2.2/jre/lib/i386

Change the above to only list the directory that contains the
libphp_java.so.
The jdk directories should go to java.library.path (or LD_LIBRARY_PATH
or ld.so.conf).  Note that java.library.path should also list the
location
of libphp_java.so (as you had correctly).

Alex


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP ext/java and sapi/servlet reliability

2001-01-18 Thread Alex Akilov

Juan,

I'm currently looking at the Java/Servlet code and trying to get it to
be
a little more stable (Sam appointed me to this task a few months ago
and I've been slowly coming up to speed).  I apologize on Sam's
behalf for not responding to you but he's moved on to other
responsibilities which involves a lot of travel and he may not be as
attentive to the needs of PHP users as he may have been in the past.

So far, I found that the Java feature is very inefficient since it
starts up
a JVM per session and could quickly max out your machine's resources.
The Servlet feature, on the other hand, is much more practical but there

may be some reentrancy bugs in it as I always get a trap after 3
attempts
if I compile without debug.  However, enabling debug appears to mask
the problem so that it doesn't trap (at least with my limited testing).
I
hope to have this fixed soon and we're planning to take it through some
more intensive stress testing to make sure it's ready for prime time.
Watch this space.

Alex


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]