PHP&Java(1)
程序员文章站
2022-04-23 19:50:19
...
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.
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
to your autoexec.bat. On NT add
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
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
to your autoexec.bat. On NT add
;C:jdk1.2.2in
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]
extension=php_java.dll
java.library.path=c:webphp4extensionsjava.class.path="c:webphp4extensionsjdk1.2.2php_java.jar;c:myclasses"
推荐阅读
-
Java垃圾收集器——Parallel、G1收集器日志分析及性能调优示范
-
Struts1之url截取_动力节点Java学院整理
-
Java深入学习(1):多线程详解
-
Intellij IDEA 2019 + Java Spring MVC + Hibernate学习笔记(1)
-
Java日志介绍(1)-java.util.logging.Logger
-
1.java小作业-计算1到100的整合-指定输入多少行输出就打印多少行-打印24小时60分钟每一分钟-重载基础练习-面向java编程初学者
-
Java基础系列--08_集合1
-
java_第一年_JDBC(1)
-
Day1_Java进阶_类加载器
-
面试刷题1: 简要介绍java平台?java是解释执行的吗?