PHP_JAVA的安装
长沙北大青鸟作者:科泰校区匿名
摘要:这是安装PHP_JAVA的范例。大家可以叁考使用,很多PHP无法处理的unix-like 底下编译的时候记得$ ./configure --with-javaphp.ini设置 win32s安装j2sdk 1.3.1 安装到 c:jdk下 安装php4.1.1 安装到 c:php下 [Java] java
这是安装PHP_JAVA的范例。大家可以叁考使用,很多PHP无法处理的
unix-like 底下编译的时候记得
$ ./configure --with-java
php.ini设置
win32s
安装j2sdk 1.3.1 安装到 c:jdk下
安装php4.1.1 安装到 c:php下
[Java] java.class.path = c:phpJAVAphp_java.jar ;php_java.jar在php4.1.1是放在c:phpJAVA java.home = c:jdk ;指定java home java.library = C:jdkjrebinhotspotjvm.dll ;j2sdk安装时安装的 java.library.path = c:phpextensions ;php_java.dll放的目录 |
|
unix-like 底下
[Java] java.class.path= /usr/local/lib/php_java.jar java.home = /usr/local/jdk java.library = /path/to/your/jvm/lib java.library.path = /usr/local/lib |
|
叁数的解释
java.class.path The path and name of the PHP jar file (usually called php_java.jar) as well as any other jar files or directories where PHP will search for compiled Java classes. java.home The root directory of the installed JDK java.library The location of the Java virtual machine library java.library.path The location of the PHP java library (usually in the modules/ directory)
Other configuration directives that may be needed not included in the default php.ini file are:
extension_dir The path of the PHP Java extension (usually the same as java.library.path) extension The name of the PHP extension to load (for UNIX systems the module is called libphp_java.so)
|
|
然后就可以用了..拿官方范例
<? // 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')); ?>
|
ok..运行一下,看到自己的作业系统和机器的名称了吗。