>  기사  >  백엔드 개발  >  PHP&Java(1)_PHP教程

PHP&Java(1)_PHP教程

WBOY
WBOY원래의
2016-07-13 17:07:24945검색

Mark Nold
Joost Soeterbroek
 
The Java extension is an extremely exciting tool. By learning how to use this module, you can extend PHP by the power of all available Java classes. To show you the basics of the Java extension, this article will cover installation and a few code examples of using PHP and Java together.

Windows Installation


The following configuration has been tested with Apache 1.3.12, PHP 4.0.3 binaries from www.php4win.de plus the 4.0.3 Zend Optimiser and JDK 1.2.2 from java.sun.com. We have also tested this configuration with older versions of the JDK and the various MS webservers (PWS and IIS) on Windows 95, Windows 98 and NT4.
Step 1: Install the JDK. This is fairly simple, as the JDK installs without many questions. It might be useful to check your environment (autoexec.bat in Windows 9x and System under Control Panel in NT) and make sure the jdk1.x.xin directory is in your path. This will make compiling your Java Classes easier. On Win9x add
PATH=%PATH%;C:jdk1.2.2in<br>

to your autoexec.bat. On NT add
;C:jdk1.2.2in<br>

to the end of the PATH environment variable. It is also important to note in your autoexec.bat file, the PHP Java extension ignores the JAVA_HOME and CLASSPATH set up in the environment. This is important because these items must be set correctly in your php.ini file for the Java extension to work.
Step 2: Modifying your php.ini. You need to add something similiar to your php.ini file
 
[java]<br>extension=php_java.dll<br>java.library.path=c:webphp4extensionsjava.class.path="c:webphp4extensionsjdk1.2.2php_java.jar;c:myclasses"<br>
<p align="left"></p><div style="display:none;">
<span id="url" itemprop="url">http://www.bkjia.com/PHPjc/630288.html</span><span id="indexUrl" itemprop="indexUrl">www.bkjia.com</span><span id="isOriginal" itemprop="isOriginal">true</span><span id="isBasedOnUrl" itemprop="isBasedOnUrl">http://www.bkjia.com/PHPjc/630288.html</span><span id="genre" itemprop="genre">TechArticle</span><span id="description" itemprop="description">Mark Nold Joost Soeterbroek The Java extension is an extremely exciting tool. By learning how to use this module, you can extend PHP by the power of all available Java classes. To s...</span>
</div>
<div class="art_confoot"></div>
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.