tryng to use the php servlet sapi with Tomcat 4.1,
I found this problems:
-- configure generates a makefile without JAVA_INCLUDES
-- make fails on servlet.c (php_module_startup call)
-- make do not build phpsrvlt.jar
-- got it working, every page start with "HTTP/1.0 200 X"
this patch fixes all this problems,
tested on :
php4-stable / php4-head
RedHat Linux 7.x and 8.0
Sun J2SDK 1.4.1_01
Tomcat 4.1.18
Servlet extension still need the LD_LIBRARY_PATH settings,
still crash sometime, but at least it compile and run.
Who is the maintainer of this sapi module ?
thanks in advance,
Giuseppe
--
-------------------------------------------------------
Giuseppe Tanzilli [EMAIL PROTECTED]
CSF Sistemi srl phone ++39 0775 7771
Via del Ciavattino Anagni FR
Italy
diff -u -r php-4.3.0_org/ext/java/config.m4 php-4.3.0_test/ext/java/config.m4 --- php-4.3.0_org/ext/java/config.m4 Fri Nov 29 14:32:49 2002 +++ php-4.3.0_test/ext/java/config.m4 Fri Jan 10 12:15:28 2003 @@ -97,7 +97,7 @@ dnl We have to find everything dnl for i in `find $PHP_JAVA/include -type d`; do - test -f $i/jni.h && JAVA_INCLUDE=-I$i + test -f $i/jni.h && JAVA_INCLUDE="$JAVA_INCLUDE -I$i" test -f $i/jni_md.h && JAVA_INCLUDE="$JAVA_INCLUDE -I$i" done @@ -178,6 +178,8 @@ fi PHP_SUBST(JAVA_CLASSPATH) + PHP_SUBST(JAVA_INCLUDE) + PHP_SUBST(JAVA_CFLAGS) PHP_ADD_MAKEFILE_FRAGMENT fi diff -u -r php-4.3.0_org/sapi/servlet/Makefile.frag php-4.3.0_test/sapi/servlet/Makefile.frag --- php-4.3.0_org/sapi/servlet/Makefile.frag Thu Mar 7 15:19:58 2002 +++ php-4.3.0_test/sapi/servlet/Makefile.frag Fri Jan 10 12:15:28 2003 @@ -1,19 +1,19 @@ -$(builddir)/java.c : $(srcdir)/../../ext/java/java.c - @cp $(srcdir)/../../ext/java/java.c $(builddir) +sapi/servlet/java.c : sapi/servlet/../../ext/java/java.c sapi/servlet/phpsrvlt.jar + @cp sapi/servlet/../../ext/java/java.c sapi/servlet -$(builddir)/phpsrvlt.jar : $(srcdir)/servlet.java $(srcdir)/../../ext/java/reflect.java - $(mkinstalldirs) $(builddir)/net/php - @echo library=php4 > $(builddir)/net/php/reflect.properties - @echo library=php4 > $(builddir)/net/php/servlet.properties - @cp $(builddir)/formatter.java $(builddir)/net/php - @cp $(builddir)/servlet.java $(builddir)/net/php - @cp $(srcdir)/../../ext/java/reflect.java $(builddir)/net/php - cd $(builddir) && javac net/php/reflect.java - @test ! -f $(builddir)/reflect.class || mv $(builddir)/reflect.class $(builddir)/net/php # bug in KJC javac - javac -classpath .:$(SERVLET_CLASSPATH):$(CLASSPATH) $(builddir)/net/php/servlet.java - @test ! -f $(builddir)/servlet.class || mv $(builddir)/servlet.class $(builddir)/net/php # bug in KJC javac - javac -classpath .:$(SERVLET_CLASSPATH):$(CLASSPATH) $(builddir)/net/php/formatter.java - @test ! -f $(builddir)/formatter.class || mv $(builddir)/formatter.class $(builddir)/net/php # bug in KJC javac - cd $(builddir)/ && $(JAVA_JAR) phpsrvlt.jar net/php/*.class net/php/*.properties - @rm -rf $(builddir)/net +sapi/servlet/phpsrvlt.jar : sapi/servlet/servlet.java +sapi/servlet/../../ext/java/reflect.java + $(mkinstalldirs) sapi/servlet/net/php + @echo library=php4 > sapi/servlet/net/php/reflect.properties + @echo library=php4 > sapi/servlet/net/php/servlet.properties + @cp sapi/servlet/formatter.java sapi/servlet/net/php + @cp sapi/servlet/servlet.java sapi/servlet/net/php + @cp sapi/servlet/../../ext/java/reflect.java sapi/servlet/net/php + cd sapi/servlet && javac net/php/reflect.java + @test ! -f sapi/servlet/reflect.class || mv sapi/servlet/reflect.class +sapi/servlet/net/php # bug in KJC javac + cd sapi/servlet && javac -classpath .:$(SERVLET_CLASSPATH):$(CLASSPATH):. +net/php/servlet.java + @test ! -f sapi/servlet/servlet.class || mv sapi/servlet/servlet.class +sapi/servlet/net/php # bug in KJC javac + cd sapi/servlet && javac -classpath .:$(SERVLET_CLASSPATH):$(CLASSPATH):. +net/php/formatter.java + @test ! -f sapi/servlet/formatter.class || mv sapi/servlet/formatter.class +sapi/servlet/net/php # bug in KJC javac + cd sapi/servlet/ && $(JAVA_JAR) phpsrvlt.jar net/php/*.class +net/php/*.properties + @rm -rf sapi/servlet/net diff -u -r php-4.3.0_org/sapi/servlet/config.m4 php-4.3.0_test/sapi/servlet/config.m4 --- php-4.3.0_org/sapi/servlet/config.m4 Thu Mar 7 15:20:00 2002 +++ php-4.3.0_test/sapi/servlet/config.m4 Fri Jan 10 12:36:13 2003 @@ -34,13 +34,15 @@ AC_DEFINE(SAPI_SERVLET, 1, [Whether you use Servlet]) INSTALL_IT="\$(mkinstalldirs) \$(libdir)" - INSTALL_IT="$INSTALL_IT; \$(INSTALL) -m 0755 \$(srcdir)/sapi/servlet/phpsrvlt.jar \$(libdir)" + INSTALL_IT="$INSTALL_IT; \$(INSTALL) -m 0755 +\$(top_srcdir)/sapi/servlet/phpsrvlt.jar \$(libdir)" INSTALL_IT="$INSTALL_IT; \$(INSTALL) -m 0755 $SAPI_SHARED \$(libdir)" PHP_SAPI=servlet PHP_BUILD_THREAD_SAFE + EXTRA_INCLUDES="$EXTRA_INCLUDES \$(JAVA_INCLUDE)" PHP_SELECT_SAPI(servlet, shared, servlet.c) - PHP_ADD_SOURCES(/sapi/servlet, java.c,,sapi) + PHP_ADD_SOURCES(/sapi/servlet, java.c,, sapi) PHP_ADD_MAKEFILE_FRAGMENT(sapi/servlet/Makefile.frag) + AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) Only in php-4.3.0_test/sapi/servlet: java.c Only in php-4.3.0_test/sapi/servlet: phpsrvlt.jar diff -u -r php-4.3.0_org/sapi/servlet/servlet.c php-4.3.0_test/sapi/servlet/servlet.c --- php-4.3.0_org/sapi/servlet/servlet.c Thu Oct 24 15:14:49 2002 +++ php-4.3.0_test/sapi/servlet/servlet.c Fri Jan 10 12:15:28 2003 @@ -71,11 +71,6 @@ extern zend_module_entry java_module_entry; -static zend_module_entry *additional_php_extensions[] = { - &java_module_entry -}; - -#define EXTCOUNT (sizeof(additional_php_extensions)/sizeof(zend_module_entry *)) /***************************************************************************/ @@ -261,7 +256,7 @@ sapi_startup(&servlet_sapi_module); - if (php_module_startup(&servlet_sapi_module, additional_php_extensions, EXTCOUNT)==FAILURE) { + if (php_module_startup(&servlet_sapi_module, &java_module_entry, 1)==FAILURE) { ThrowServletException(jenv,"module startup failure"); return; } diff -u -r php-4.3.0_org/sapi/servlet/servlet.java php-4.3.0_test/sapi/servlet/servlet.java --- php-4.3.0_org/sapi/servlet/servlet.java Wed Feb 27 08:29:18 2002 +++ php-4.3.0_test/sapi/servlet/servlet.java Fri Jan 10 12:15:28 2003 @@ -107,6 +107,8 @@ else if (data.startsWith("Location: ")) { response.sendRedirect(data.substring(data.indexOf(" ") + 1)); + } else if (data.startsWith("HTTP/1")) { + return; // this one is added from servlet container (Tomcat 4.1), we have to +check for others } else {
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php