Menu

[r608]: / trunk / php-java-bridge / examples / php+jsp / settings.php  Maximize  Restore  History

Download this file

130 lines (118 with data), 4.6 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<html>
<?php
if(!extension_loaded('java')) require_once("java/Java.inc");
$Util = java("php.java.bridge.Util");
$ctx = java_context();
/* get the current instance of the JavaBridge, ServletConfig and Context */
$bridge = $ctx->getAttribute( "php.java.bridge.JavaBridge", 100);
$config = $ctx->getAttribute ( "php.java.servlet.ServletConfig", 100);
$context = $ctx->getAttribute( "php.java.servlet.ServletContext", 100);
$CGIServlet = java("php.java.servlet.PhpCGIServlet");
$servlet = $ctx->getAttribute( "php.java.servlet.Servlet", 100);
?>
<head>
<title>PHP/Java Bridge settings</title>
</head>
<body bgcolor="#FFFFFF">
<H1>PHP/Java Bridge settings</H1>
<p>
The PHP/Java Bridge web application contains two servlets. The <code>PhpJavaServlet</code> handles requests from remote PHP scripts running in Apache/IIS or from the command line.
The second servlet <code>PhpCGIServlet</code> can handle requests from internet clients directly.
<p>
The following shows the settings of the <code>PhpJavaServlet</code> and the <code>PhpCGIServlet</code>.
</p>
<H2>PhpJavaServlet</H2>
<p>
The <code>PhpJavaServlet</code> handles requests from PHP clients.
<blockquote>
<code>
Apache/IIS/console::PHP &lt;--&gt; PhpJavaServlet
</code>
</blockquote>
It listens for PHP/Java Bridge protocol requests on the local interface or on all available network interfaces and invokes Java methods or procedures. The following example accesses the bridge listening on the <strong>local</strong> interface:
<blockquote>
<code>
&lt;?php <br>
require_once("http://localhost:8080/JavaBridge/java/Java.inc");<br>
$System = java("java.lang.System");<br>
echo $System->getProperties();<br>
?&gt;
</code>
</blockquote>
</p>
<table BORDER=1 CELLSPACING=5 WIDTH="85%" >
<tr VALIGN=TOP>
<th>Option</th>
<th>Value</th>
<th WIDTH="60%">Description</th>
</tr>
<tr>
<td>servlet_log_level</td>
<td><?php echo java_values($bridge->getlogLevel());?></td>
<td>The request log level.</td>
</tr>
<tr>
<td>promiscuous</td>
<td><?php echo java_values($Util->JAVABRIDGE_PROMISCUOUS) ? "On" : "Off" ?></td>
<td>Shall the bridge accept requests from <strong>non-local</strong> PHP scripts?</td>
</tr>
</table>
</p>
<p>
<?php if (java_instanceof ($servlet, $CGIServlet)) { ?>
<H2>PhpCGIServlet</H2>
<p>
The <code>PhpCGIServlet</code> runs PHP scripts within the J2EE/Servlet engine.
</p>
<blockquote>
<code>
internet browser &lt;--&gt; PhpCGIServlet &lt;--&gt; php-cgi &lt;--&gt; PhpJavaServlet
</code>
</blockquote>
<p>
It starts a PHP FastCGI server, if possible and necessary. Requests for PHP scripts are delegated to the FastCGI server. If the PHP code contains Java calls, the PHP/Java Bridge protocol requests are delegated back to the current VM, to an instance of the <code>PhpJavaServlet</code>.
</p>
<table BORDER=1 CELLSPACING=5 WIDTH="85%" >
<tr VALIGN=TOP>
<th>Option</th>
<th>Value</th>
<th WIDTH="60%">Description</th>
</tr>
<tr>
<td>override_hosts</td>
<td><?php $val=java_values($config->getInitParameter("override_hosts")); echo $val?$val:"On"?></td>
<td>Should the servlet engine delegate protocol requests back to the current VM?</td>
</tr>
<tr>
<td>php_exec</td>
<td><?php $val=java_values($config->getInitParameter("php_exec")); echo $val?$val:"php-cgi"?></td>
<td>The PHP FastCGI or CGI binary.</td>
</tr>
<tr>
<td>prefer_system_php_exec</td>
<td><?php $val=java_values($config->getInitParameter("prefer_system_php_exec")); echo $val?$val:"Off"?></td>
<td>May we use /usr/bin/php-cgi or c:/php/php-cgi.exe if a local WEB-INF/cgi/php-cgi-ARCH-OS executable is available?</td>
</tr>
<tr>
<td>max_requests</td>
<td><?php $val=java_values($servlet->getCGIMaxRequests()); echo $val?$val:"20"?></td>
<td>How many parallel requests should the servlet engine handle?</td>
</tr>
<tr>
<td>use_fast_cgi</td>
<td><?php $val=java_values($config->getInitParameter("use_fast_cgi")); echo $val?$val:"Autostart"?></td>
<td>Shall the bridge start an internal, or use an external or no PHP FastCGI server?</td>
</tr>
<tr>
<td>shared_fast_cgi_pool</td>
<td><?php $val=java_values($config->getInitParameter("shared_fast_cgi_pool")); echo $val?$val:"Off"?></td>
<td>Are there two bridges accessing the same FastCGI pool? Set this to On in <strong>both</strong>, the global web.xml and in the WEB-INF/web.xml of the JavaBridge context.</td>
</tr>
</table>
</p>
<?php /* current sevlet is CGIServlet */ } ?>
The settings were taken from the <a href="file://<?php
echo java_values($CGIServlet->getRealPath($context, '/WEB-INF/web.xml'))
?>">WEB-INF/web.xml</a>.
</body>
</html>
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.