I read on java in php at http://www.php.net/manual/en/ref.java.php
When I try their example of:
I get the error
I am using php version 4.2.2 and this is what was configured during install:
Anyone has any ideas on how to get java working with php?
I have created php.ini to just add the following:
I don't really want to use servlet - rather java sxtension if possible?
When I try their example of:
PHP:
<?php
// get instance of Java class java.lang.System in PHP
$system = new Java('java.lang.System');
// demonstrate property access
print 'Java version='.$system->getProperty('java.version').' <br>';
print 'Java vendor=' .$system->getProperty('java.vendor').' <br>';
print 'OS='.$system->getProperty('os.name').' '.
$system->getProperty('os.version').' on '.
$system->getProperty('os.arch').' <br>';
// java.util.Date example
$formatter = new Java('java.text.SimpleDateFormat',
"EEEE, MMMM dd, yyyy 'at' h:mm:ss a zzzz");
print $formatter->format(new Java('java.util.Date'));
?>
I get the error
Fatal error: Cannot instantiate non-existent class: java in /Library/WebServer/Documents/java.php on line 3
I am using php version 4.2.2 and this is what was configured during install:
'./configure' '--disable-cli' '--with-apxs' '--with-mysql' '--with-pgsql' '--with-gd=/usr/local' '--with-png-dir=/usr/local' '--with-zlib-dir=/usr' '--with-jpeg-dir=/usr/local' '--with-freetype-dir=/usr/local' '--with-t1lib=/usr/local' '--enable-trans-sid' '--enable-exif' '--with-xml' '--enable-wddx' '--with-curl=/usr/local' '--with-pdflib=/usr/local' '--enable-ftp' '--enable-mbstring' '--enable-mbstr-enc-trans' '--with-ldap' '--enable-xslt' '--with-xslt-sablot=/usr/local' '--with-imap=../imap-2001a' '--enable-dbx' '--enable-dbase' '--with-mcrypt=/usr/local' '--enable-sockets'
Anyone has any ideas on how to get java working with php?
I have created php.ini to just add the following:
simon1663% cat *
[Java]
;java.class.path = .\php_java.jar
java.home = /usr/bin
;java.library = c:\jdk\jre\bin\hotspot\jvm.dll
;java.library.path = .\
simon1663% which java
/usr/bin/java
simon1663% java -version
java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-root-010902-18:51)
Java HotSpot(TM) Client VM (build 1.3.1, mixed mode)
I don't really want to use servlet - rather java sxtension if possible?