Re: [PHP4BETA] Java and C++ method support

From: Date: Tue, 18 Jan 2000 01:26:27 +0000
Subject: Re: [PHP4BETA] Java and C++ method support
Groups: php.version4 
Request: Send a blank email to php-version4+get-9207@lists.php.net to get a copy of this message
One thing I will say about PHP is that if I look away for a moment, people will pitch in to answer questions! AL Lewis wrote: > Does the --with-Java tag in the configure mean that php supports DIRECT > implementation of Java methods? If so is it just a case of the methods > being used being in the CLASSPATH and php "knowing" the location of the > jre? --with-java tag in the configure will enable php to directly create Java objects, access Java attributes, and invoke Java methods. Bryan Batchelder wrote: > also, what all goes into adding functionality to PHP? Like if I want to > write my own extensions? I have done this in cold fusion and it is > incredibly easy (just write a .dll and register that dll with CF). Again, > if someone could point me to a good start I would *really* be appreciative. Having written one, the best advice I can give is find an existing extension that is actively maintained and as close to what you need, and use it as a sample. I based ext/java on ext/com. Egon Schmid wrote: > It is not documented yet. Sam Ruby will see some COM documentation first > :-) I don't see any examples in the current documentation for any OO extensions, so I honestly don't know where to begin. From a language point of view, I've defined a new object type named Java. It can be used to create any Java object - and clearly including the Java class reference recast in PHP syntax in the manual is not desirable. Everything I think is relevant, I've placed in the READMEs. If someone has any suggestions on how to incorporate this information into the existing manual, I would appreciate it. > I have it now working with some support from Sam Ruby. Unfortunatly only > one of the two examples (jver.php) in ext/java works on Linux RH 6.0. The jawt.php example doesn't make much sense when running under a daemon process. It must be run as a CGI under a user process in order for you to see the results. Both were originally developed under Linux RH 6.1. > I have followed the instructions in the README file in ext/java. Then > there was only a little error in the generated Makefile, the description > for the php.ini was a little bit misleading and to get Java to work for > user "nobody" I wrote the CLASSPATH and other necessary environment > variables into Apaches bin/apachectl file. Let's take a look at this, one item at a time. On RedHat 6.1, jar is not by default a part of the path, but zip will support a -0 parameter which essentially will do the same thing. Aparently on Egon's machine, zip does not support a -0 parameter, but he was able to get the sample to work by adding the jar executable into the path. I can take a look at making the makefile more adaptable. Egon has sent me e-mail offline telling me what he did to get php.ini to work. I'm still a bit puzzled by what he did. Once I understand what changes are necessary to get working in his environment, I'll make whatever updates are required to the readme. From what I can see, he is using the IBM JDK 1.1.8, which requires java.library to be fully qualified and doesn't support the java.library.path. Egon was very inventive in getting the system to work, however, by adding entries to his apachectl instead. I believe that his real problem was that, indeed, in order to use the resulting jar files under Apache, they must be able to be read by user "nobody". I'll update the readme to make this clear. > PS: It works definitely with php-4.0b3 and not with the current CVS. It seems that every time I look, the Unix build process is being rewritten again. As a rule, there seems to be an honest attempt to keep my code in synch, but generally this is not enough. Building a working system on Unix including java will be hit or miss until this is complete. By contrast, the build process on Windows has been remarkably stable over the same time period. - Sam Ruby

« previous php.version4 (#9207) next »