|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2000-03-29 22:14 UTC] jesusmc at scripps dot edu
(This is related to bug ID # 3972)
The only way I could get Java support to compile for PHP 4.0RC1 in Solaris 2.6, was to manually create the jar files.
I used the following config command:
./configure --prefix=/asd/dredox3/development/php4 \
--with-config-file-path=/asd/dredox3/development/php4 \
--enable-track-vars --enable-magic-quotes \
--enable-xml --enable-wddx --disable-debug\
--with-servlet=/asd/metallo1/server/jserv/JSDK2.0\
--enable-bcmath --enable-trans-id\
--with-java=/asd/prog/opt/jdk1.2 \
--with-gd=/asd/metallo1/server/libs/gd \
--with-mysql\
--with-apxs=/asd/dredox3/development/apache/sbin/apxs
And noticed several errors when compiling, mostly in the "sapi/servlet/" dir. One was related to the file "sapi/servlet/servlet.java", which was using an incorrect method (at least for Sun's JSDK 2.0). The diff is below:
*** php-4.0RC1/sapi/servlet/servlet.java Tue Mar 28 16:14:32 2000
--- orig-php-4.0RC1/sapi/servlet/servlet.java Thu Mar 9 05:07:24 2000
***************
*** 86,94 ****
} else {
int colon = data.indexOf(": ");
if (colon > 0) {
! /*response.addHeader(data.substring(0,colon),*/
! /* JSDK 2.0 uses setHeader instead. JMC */
! response.setHeader(data.substring(0,colon),
data.substring(colon+2));
} else {
response.getWriter().println(data);
--- 86,92 ----
} else {
int colon = data.indexOf(": ");
if (colon > 0) {
! response.addHeader(data.substring(0,colon),
data.substring(colon+2));
} else {
response.getWriter().println(data);
***************
*** 134,141 ****
try {
if (stream != null) stream.close();
} catch (IOException e) {
! /* JSDK 2.0 - Exception is a sting - JMC */
! throw new ServletException(e.toString());
}
}
--- 132,138 ----
try {
if (stream != null) stream.close();
} catch (IOException e) {
! throw new ServletException(e);
}
}
Even after this was done, the generated makefile was still giving trouble. So I manually compiled the jar file:
% cd sapi/servlet
% mkdir net; mkdir net/php
% echo library=php4 | tee net/php/reflect.properties > net/php/servlet.properties
% cp formatter.java servlet.java net/php
% cp ../../ext/java/reflect.java net/php
% javac -classpath .:/asd/metallo1/server/jserv/JSDK2.0/lib/jsdk.jar:/asd/prog/opt/jdk1.2:./net/php net/php/*.java
% jar cf phpsrvlt.jar net/php/*.class net/php/*.properties
And once this was done, the problem was in "ext/java", where for some reason, the Makefile was not created, so I did also a manual jar file creation, following the Makefile.in steps.
Just to make sure it was not a problem w/ my inital config. I did "make clean", removed the "*.cache" and configured again, this time w/ a JDK 1.1.x, same result. The "ext/java/Makefile" was not existent, and there were problems w/ the jar file creation in the "sapi/servlet" dir.
This is a problem that seems correlated w/ the failures I mentioned in bug report ID # 3972.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Sun Jun 28 12:00:02 2026 UTC |
That is good info: Re: 1) I will download the JSDK 2.2 later and try a clean compile, and will see how it fares. That JSDK supports "setHeader" still, so you could just use that or a kludge like the one below, it compiles but I have not tested it so I can't tell if it does the right thing: (it uses the introspection classes) % diff -c php-4.0RC1/sapi/servlet/servlet.java orig-php-4.0RC1/sapi/servlet/servlet.java *** php-4.0RC1/sapi/servlet/servlet.java Thu Mar 30 17:02:04 2000 --- orig-php-4.0RC1/sapi/servlet/servlet.java Thu Mar 9 05:07:24 2000 *************** *** 23,30 **** import java.util.Enumeration; import javax.servlet.*; import javax.servlet.http.*; - import java.lang.Class; - import java.lang.reflect.Method; public class servlet extends HttpServlet { --- 23,28 ---- *************** *** 88,112 **** } else { int colon = data.indexOf(": "); if (colon > 0) { ! /* ! * JSDK 2.0 uses setHeader instead but JDSK 2.2 uses addHeader, ! * although setHeader is still valid -- JMC ! */ ! // kludge because in Java there's no #ifdef ! String params[] = {data.substring(0,colon), data.substring(colon+2)}; ! try { ! Method methodHeader = ! this.getClass().getMethod("addHeader",null).getName().equals("") ? ! this.getClass().getMethod("setHeader",null) : ! this.getClass().getMethod("addHeader",null); ! methodHeader.invoke (this, params); ! } catch (Exception e) { ! System.err.println("Could not invoke header method"); ! } ! } else { ! response.getWriter().println(data); } - } } catch (IOException e) { System.err.print(data); } --- 86,97 ---- } else { int colon = data.indexOf(": "); if (colon > 0) { ! response.addHeader(data.substring(0,colon), ! data.substring(colon+2)); ! } else { ! response.getWriter().println(data); ! } } } catch (IOException e) { System.err.print(data); } *************** *** 142,154 **** send(request.getMethod(), request.getQueryString(), request.getPathInfo(), contextPath, request.getContentType(), request.getContentLength(), ! request.getRemoteUser(), display_source_mode); try { if (stream != null) stream.close(); } catch (IOException e) { ! /* JSDK 2.0 - Exception is a string - JMC */ ! throw new ServletException(e.toString()); } } --- 127,138 ---- send(request.getMethod(), request.getQueryString(), request.getPathInfo(), contextPath, request.getContentType(), request.getContentLength(), ! request.getRemoteUser(), display_source_mode); try { if (stream != null) stream.close(); } catch (IOException e) { ! throw new ServletException(e); } } Re: 2) The "still giving trouble" comment referred to the problem that the makefile was dying on the "@test" lines (when creating the net/php" subdir and later on the class compilation line and the jar creation. Might be a cobined problem from the previous messed up compilations. Re: 3) I noticed that. So only the jar file in the sapi/servlet dir is needed. Question: Do I need to add the servlet support to gain the java support? Can I just get java support alone?1) I'll look into introspection (JServ is popular and is stuck at JSDK 2.0). Looking at your code, I think there are a few things that need to be fixed (example: getMethod should be passed new Class[] {} instead of null, and will throw an exception if the method is not found). 2) If test is failing on Solaris, then I did something wrong. Not every OS supports the same options, so I need to settle on the least common denominator. 3) No, you don't need servlet support to get Java support.