Building Apache PHP with java

myBox

Active Member
Jan 6, 2004
40
0
156
Hi,

I am trying to setup apache PHP with java but I get errors

/home/cpapachebuild/buildapache/php-4.4.2/main/main.c: In function `php_verror':
/home/cpapachebuild/buildapache/php-4.4.2/main/main.c:504: warning: passing arg 1 of `php_escape_html_entities' discards quali
fiers from pointer target type
make: *** [/home/cpapachebuild/buildapache/php-4.4.2/ext/java/php_java.jar] Error 1
make: *** [/home/cpapachebuild/buildapache/php-4.4.2/ext/java/php_java.jar] Error 1
the above are the errors reported from cpanel build apache.

I already installed JAVA from sun and tested it and set the env variables JAVA_HOME etc..

where can I start looking to trouble shoot this problem and what could be something I am doning wrong?

java version
[email protected] [/]# java -version
java version "1.4.2"
gcj (GCC) 3.4.5 20051201 (Red Hat 3.4.5-2)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
java env variables
JAVA_HOME=/usr/java/j2sdk1.4.2_12
CLASSPATH=/usr/java/j2sdk1.4.2_12/lib/tools.jar:/usr/java/j2sdk1.4.2_12/jre/lib/rt.jar:./
Helpful articles I used:
http://www.yolinux.com/TUTORIALS/LinuxTutorialJava.html#INSTALLSDK
http://www.raditha.com/php/java.php
http://www.onlamp.com/pub/a/php/2001/06/14/php_jav.html
http://www.php.net/java

thanks in advance.
 

myBox

Active Member
Jan 6, 2004
40
0
156
I have rebuilt apache with verbous mode on

I got this error:

bin/sh /home/cpapachebuild/buildapache/php-4.4.2/libtool --silent --preserve-dup-deps --mode=link gcc -export-dynamic -g -O2 -L/usr/X11R6/lib -L/usr/local/jdk/jre/lib/i386/server -L/usr/local/jdk/jre/lib/i386/native_threads -L/usr/local/jdk/jre/lib/i386 -L/usr/X11R6/lib64 -lstdc++ -R /usr/X11R6/lib -R /usr/local/jdk/jre/lib/i386/server -R /usr/local/jdk/jre/lib/i386/native_threads -R /usr/local/jdk/jre/lib/i386 ext/pcre/pcrelib/pcre_chartables.lo ext/pcre/pcrelib/pcre_compile.lo ext/pcre/pcrelib/pcre_config.lo ext/pcre/pcrelib/pcre_dfa_exec.lo ext/pcre/pcrelib/pcre_exec.lo ext/pcre/pcrelib/pcre_fullinfo.lo ext/pcre/pcrelib/pcre_get.lo ext/pcre/pcrelib/pcre_globals.lo ext/pcre/pcrelib/pcre_info.lo ext/pcre/pcrelib/pcre_maketables.lo ext/pcre/pcrelib/pcre_ord2utf8.lo ext/pcre/pcrelib/pcre_printint.lo ext/pcre/pcrelib/pcre_refcount.lo ext/pcre/pcrelib/pcre_study.lo ext/pcre/pcrelib/pcre_tables.lo ext/pcre/pcrelib/pcre_try_flipped.lo ext/pcre/pcrelib/pcre_ucp_findchar.lo ext/pcre/pcrelib/pcre_valid_utf8.lo ext/pcre/pcrelib/pcre_version.lo ext/pcre/pcrelib/pcre_xclass.lo ext/pcre/php_pcre.lo ext/zlib/zlib.lo ext/zlib/zlib_fopen_wrapper.lo ext/ctype/ctype.lo ext/exif/exif.lo ext/gd/gd.lo ext/gd/gdttf.lo ext/gd/libgd/gd.lo ext/gd/libgd/gd_gd.lo ext/gd/libgd/gd_gd2.lo ext/gd/libgd/gd_io.lo ext/gd/libgd/gd_io_dp.lo ext/gd/libgd/gd_io_file.lo ext/gd/libgd/gd_ss.lo ext/gd/libgd/gd_io_ss.lo ext/gd/libgd/gd_png.lo ext/gd/libgd/gd_jpeg.lo ext/gd/libgd/gdxpm.lo ext/gd/libgd/gdfontt.lo ext/gd/libgd/gdfonts.lo ext/gd/libgd/gdfontmb.lo ext/gd/libgd/gdfontl.lo ext/gd/libgd/gdfontg.lo ext/gd/libgd/gdtables.lo ext/gd/libgd/gdft.lo ext/gd/libgd/gdcache.lo ext/gd/libgd/gdkanji.lo ext/gd/libgd/wbmp.lo ext/gd/libgd/gd_wbmp.lo ext/gd/libgd/gdhelpers.lo ext/gd/libgd/gd_topal.lo ext/gd/libgd/gd_gif_in.lo ext/gd/libgd/xbm.lo ext/gd/libgd/gd_gif_out.lo ext/gettext/gettext.lo ext/iconv/iconv.lo ext/mcrypt/mcrypt.lo ext/mysql/php_mysql.lo ext/overload/overload.lo ext/posix/posix.lo ext/session/session.lo ext/session/mod_files.lo ext/session/mod_mm.lo ext/session/mod_user.lo ext/sockets/sockets.lo regex/regcomp.lo regex/regexec.lo regex/regerror.lo regex/regfree.lo ext/standard/array.lo ext/standard/base64.lo ext/standard/basic_functions.lo ext/standard/browscap.lo ext/standard/crc32.lo ext/standard/crypt.lo ext/standard/cyr_convert.lo ext/standard/datetime.lo ext/standard/dir.lo ext/standard/dl.lo ext/standard/dns.lo ext/standard/exec.lo ext/standard/file.lo ext/standard/filestat.lo ext/standard/flock_compat.lo ext/standard/formatted_print.lo ext/standard/fsock.lo ext/standard/head.lo ext/standard/html.lo ext/standard/image.lo ext/standard/info.lo ext/standard/iptc.lo ext/standard/lcg.lo ext/standard/link.lo ext/standard/mail.lo ext/standard/math.lo ext/standard/md5.lo ext/standard/metaphone.lo ext/standard/microtime.lo ext/standard/pack.lo ext/standard/pageinfo.lo ext/standard/parsedate.lo ext/standard/quot_print.lo ext/standard/rand.lo ext/standard/reg.lo ext/standard/soundex.lo ext/standard/string.lo ext/standard/scanf.lo ext/standard/syslog.lo ext/standard/type.lo ext/standard/uniqid.lo ext/standard/url.lo ext/standard/url_scanner.lo ext/standard/var.lo ext/standard/versioning.lo ext/standard/assert.lo ext/standard/strnatcmp.lo ext/standard/levenshtein.lo ext/standard/incomplete_class.lo ext/standard/url_scanner_ex.lo ext/standard/ftp_fopen_wrapper.lo ext/standard/http_fopen_wrapper.lo ext/standard/php_fopen_wrapper.lo ext/standard/credits.lo ext/standard/css.lo ext/standard/var_unserializer.lo ext/standard/ftok.lo ext/standard/aggregation.lo ext/standard/sha1.lo ext/tokenizer/tokenizer.lo ext/xml/xml.lo ext/xml/expat/xmlparse.lo ext/xml/expat/xmlrole.lo ext/xml/expat/xmltok.lo TSRM/TSRM.lo TSRM/tsrm_strtok_r.lo TSRM/tsrm_virtual_cwd.lo main/main.lo main/snprintf.lo main/spprintf.lo main/php_sprintf.lo main/safe_mode.lo main/fopen_wrappers.lo main/alloca.lo main/php_scandir.lo main/php_ini.lo main/SAPI.lo main/rfc1867.lo main/php_content_types.lo main/strlcpy.lo main/strlcat.lo main/mergesort.lo main/reentrancy.lo main/php_variables.lo main/php_ticks.lo main/streams.lo main/network.lo main/php_open_temporary_file.lo main/php_logos.lo main/output.lo main/memory_streams.lo main/user_streams.lo Zend/zend_language_parser.lo Zend/zend_language_scanner.lo Zend/zend_ini_parser.lo Zend/zend_ini_scanner.lo Zend/zend_alloc.lo Zend/zend_compile.lo Zend/zend_constants.lo Zend/zend_dynamic_array.lo Zend/zend_execute_API.lo Zend/zend_highlight.lo Zend/zend_llist.lo Zend/zend_opcode.lo Zend/zend_operators.lo Zend/zend_ptr_stack.lo Zend/zend_stack.lo Zend/zend_variables.lo Zend/zend.lo Zend/zend_API.lo Zend/zend_extensions.lo Zend/zend_hash.lo Zend/zend_list.lo Zend/zend_indent.lo Zend/zend_builtin_functions.lo Zend/zend_sprintf.lo Zend/zend_ini.lo Zend/zend_qsort.lo Zend/zend_multibyte.lo Zend/zend_strtod.lo Zend/zend_execute.lo sapi/cgi/cgi_main.lo sapi/cgi/getopt.lo main/internal_functions.lo -lcrypt -lcrypt -lmysqlclient -lmcrypt -lltdl -ljava -lfreetype -lX11 -lXpm -lpng -lz -ljpeg -lz -lresolv -lm -ldl -lnsl -lcrypt -lcrypt -o sapi/cgi/php
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error occurred during initialization of VM
Could not reserve enough space for object heap
initfpsuexec: using apache 1.x support
after that I disabled shell boom protection as suggested by some posts.

tested and same problem.

also did this:

alias java='java -Xms32m -Xmx128m'
now rebooted and tested the rebuilding again

but same result :(

when running : java -version as root same as normal user

java version "1.4.2_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04)
Java HotSpot(TM) Client VM (build 1.4.2_05-b04, mixed mode)
I have also put this in /etc/rc.local

export LD_ASSUME_KERNEL=2.4.0
still no luck!

I did not install Tomcat or any jsp stuff.

My main goal is to run java classes from php
www.php.net/java


PHP compile params:
(--with-apxs=/usr/local/apache/bin/apxs --prefix=/usr/local --with-xml --enable-bcmath --enable-calendar --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr --with-xpm-dir=/usr/X11R6 --with-java=/usr/local/jdk --enable-magic-quotes --with-mysql=/usr --enable-discard-path --with-pear --enable-sockets --enable-track-vars --with-ttf --with-freetype-dir=/usr --enable-gd-native-ttf --with-zlib)....
rpm -qa | grep java =>
gcc-java-3.4.5-2
java-1.4.2-gcj-compat-1.4.2.0-27jpp
any help would be appreciated.

I am using latest cpanel 10 STABLE 120

with CENTOS 2.6.15.7 kernel


Other helpful threads:
http://forums.cpanel.net/showthread.php?t=34406
http://forums.cpanel.net/showthread.php?t=34112
http://forums.cpanel.net/showthread.php?t=46428
http://webhostingtalk.com/showthread.php?t=238359
 

AndyReed

Well-Known Member
PartnerNOC
May 29, 2004
2,221
4
193
Minneapolis, MN
myBox said:
I am trying to setup apache PHP with java but I get errors

the above are the errors reported from cpanel build apache.

I already installed JAVA from sun and tested it and set the env variables JAVA_HOME etc..

where can I start looking to trouble shoot this problem and what could be something I am doning wrong?
Integrating Java with Php is a very complex process. We did that for one of our clients last year and I am not sure if he still uses Java with Php. In any case here is one more Web site that might help: http://www.php.net/manual/en/ref.java.php
Now, if you are successful in integrating Java with php, you should see something like the following in your Phpinfo.php file:

Code:
[CENTER][B]java[/B][/CENTER]
[B]Directive[/B]          [B]Local Value[/B]                    
java.class.path          /usr/lib/php4/php_java.jar
java.home               /usr/local/j2sdk1.3.1
java.library              /usr/local/j2sdk1.3.1/jre/lib/ppc/classic/libjvm.so
java.library.path      /usr/lib/php4
 
Last edited: