[英]How to integrate PHP and JAVA?
I need an urgent help from you people.I got something very odd while trying to integrate php with java. 我需要你们的紧急帮助。在尝试将php与Java集成时,我感到有些奇怪。 First, my system specifications:
首先,我的系统规格:
Windows XP Windows XP
I have installed 我已经安装
XAMPP server:- xampp-win32-1.6.1-installer XAMPP服务器:-xampp-win32-1.6.1-安装程序
This install PHP, Apache, and MySQL on my system. 这将在我的系统上安装PHP,Apache和MySQL。 There versions are as follows
版本如下
Apache Version :- Apache/2.2.4 (Win32) Apache版本:-Apache / 2.2.4(Win32)
PHP version :- 4.3.1 PHP版本:-4.3.1
Sun Microsystems JDK version :- jdk1.6.0_16 Sun Microsystems JDK版本:-jdk1.6.0_16
I am achieving this PHP-JAVA extensoion using php-javabridge. 我正在使用php-javabridge实现此PHP-JAVA扩展。 I have downloaded javabridge.jar file from following url.
我已经从以下网址下载了javabridge.jar文件。
placed the downloaded javabridge.jar file on this path C:\\xampp\\php\\ext\\ 将下载的javabridge.jar文件放在此路径C:\\ xampp \\ php \\ ext \\
Settings done in php.ini file for php-java integration are as follows. 在php.ini文件中完成的用于php-java集成的设置如下。
; ; Directory in which the loadable extensions (modules) reside.
可加载的扩展(模块)所在的目录。 extension_dir = "C:\\xampp\\php\\ext\\"
extension_dir =“ C:\\ xampp \\ php \\ ext \\”
I also uncomment the java extension. 我也取消注释Java扩展。
extension=php_java.dll 扩展名= php_java.dll
I have added following lines in Module Settings section of PHP.ini file. 我在PHP.ini文件的“模块设置”部分中添加了以下几行。
;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;; ;
; Module Settings ;
模块设置; ;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;
[Java] ;This points to the directory where your Java ;classes will be stored. [Java];这指向Java类的存储目录。 You can designate multiple ;paths, each path separated by a semicolon.
您可以指定多个;路径,每个路径用分号分隔。 ;It must also include the location of php_java.jar java.class.path = "C:\\xampp\\php\\ext\\JavaBridge.jar;C:\\xampp\\php\\extensions\\php_java.jar;C:\\Program Files\\Java\\jdk1.6.0_16\\jre\\lib;C:\\Program Files\\Java\\jdk1.6.0_16;C:\\prog"
;还必须包含php_java.jar java.class.path =“ C:\\ xampp \\ php \\ ext \\ JavaBridge.jar; C:\\ xampp \\ php \\ extensions \\ php_java.jar; C:\\ Program Files \\ Java \\ jdk1.6.0_16 \\ jre \\ lib; C:\\ Program Files \\ Java \\ jdk1.6.0_16; C:\\ prog“
;java.class.path = "C:\\xampp\\php\\extensions\\php_java.jar;C:\\prog" ; ; java.class.path =“ C:\\ xampp \\ php \\ extensions \\ php_java.jar; C:\\ prog”; This points to the bin directory of the JDK.
这指向JDK的bin目录。 java.home = "C:\\Program Files\\Java\\jdk1.6.0_16\\bin"
java.home =“ C:\\ Program Files \\ Java \\ jdk1.6.0_16 \\ bin”
; ; This must point to the Java Virtual Machine (jvm.dll) file.
这必须指向Java虚拟机(jvm.dll)文件。 java.library = "C:\\Program Files\\Java\\jdk1.6.0_16\\jre\\bin\\server\\jvm.dll"
java.library =“ C:\\ Program Files \\ Java \\ jdk1.6.0_16 \\ jre \\ bin \\ server \\ jvm.dll”
; ; This must point to the location of php_java.dll.
这必须指向php_java.dll的位置。 java.library.path = "C:\\xampp\\php\\ext;C:\\Program Files\\Java\\jdk1.6.0_16\\jre\\lib"
java.library.path =“ C:\\ xampp \\ php \\ ext; C:\\ Program Files \\ Java \\ jdk1.6.0_16 \\ jre \\ lib”
java.java = "C:\\Program Files\\Java\\jdk1.6.0_16\\bin\\javaw.exe" java.java =“ C:\\ Program Files \\ Java \\ jdk1.6.0_16 \\ bin \\ javaw.exe”
When I start the apache server service, the program runs ok. 当我启动apache服务器服务时,程序运行正常。 But, if I close the browser and open it again, the program no longer runs and give me a "Fatal error: Unable to create Java Virtual Machine in C:\\php\\java.php ...".
但是,如果我关闭浏览器并再次打开它,该程序将不再运行,并显示“致命错误:无法在C:\\ php \\ java.php ...中创建Java虚拟机”。 If I restart the apache server service, the program works again, but with the same behavior: if I close the browser window and open it again, it does not work.
如果重新启动apache服务器服务,则该程序将再次运行,但是具有相同的行为:如果关闭浏览器窗口并再次将其打开,它将无法运行。 I checked on internet but dont get any solution but found many people facing same problem.
我检查了互联网,但没有得到任何解决方案,但发现许多人面临着同样的问题。 And many of them told its a bug in PHP-JAVA bridge.
他们中的许多人都说这是PHP-JAVA桥中的错误。 So is there any solution on this problem.
那么有没有解决这个问题的办法。 I ran out of options and, if anyone could help, I'll appreciate.
我没有其他选择,如果有人可以提供帮助,我将不胜感激。 Thank You.
谢谢。
I tried the Php-JavaBridge recently, by downloading the latest version of Apache, Tomcat and using JDK8.0 and I think Php 5.4 and got it to work totally fine. 我最近尝试了Php-JavaBridge,方法是下载最新版本的Apache,Tomcat和使用JDK8.0,我认为Php 5.4可以正常工作。
Perhaps try downloading the latest version of everything, start from scratch and install again, it may be you have some version mismatches. 也许尝试下载所有内容的最新版本,从头开始并重新安装,可能是您的某些版本不匹配。
I was using a Windows 64 bit computer, running Windows7. 我使用的是运行Windows7的Windows 64位计算机。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.