Getting PHP to run in OC4J is trivial: simply make sure that the directory from PHP is in the executable path and without space on it.
Every web application can specify a set of welcome-files.
In WEBAPP/WEB-INF/web.xml, make sure you have the following:
<welcome-file-list>
<welcome-file>index.php</welcome-file>
</welcome-file-list>
Note that running PHP from within OC4J can be not only interesting, but very slow compared to using JSP or servlets instead. Consider fronting OC4J with Apache or something else that can embed PHP directly to save the extra overhead of external process invocation.
In global-web-application.xml :
<servlet>
<servlet-name>php</servlet-name>
<servlet-class>com.evermind.server.http.CGIServlet</servlet-class>
<init-param>
<param-name>interpreter</param-name>
<param-value>php</param-value>
</init-param>
</servlet>
php must not be installed in a path with space like in the program files directory
Php version 5.
If you use php.exe, you may have a white page if you don't have in the first line of your php file a carriage return. Very strange …
<html><head><title>gerardnico.com</title></head>
<body bgcolor="#FFFFFF">
<h2>gerardnico.com</h2>
<B><?php echo 'Hello World'; ?></B>
</body>
</html>
Php-cgi.exe take a long time and don't return anything …
File hello_world.php in C:\php\
<?php phpinfo(); ?>
In a command dos
C:\PHP>php-cgi.exe hello_world.php
...........................
<p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
</p>
<p>If you did not receive a copy of the PHP license, or have any questions about PHP licensing, please contact [email protected].
</p>
</td></tr>
</table><br />
</div></body></html>
C:\PHP>
C:\PHP>
Now with php.exe
C:\PHP>php.exe hello_world.php
..............................
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
If you did not receive a copy of the PHP license, or have any
questions about PHP licensing, please contact [email protected].
C:\PHP>
This is a free, open-source offering that wraps the Zend core engine. You can configure it to operate in the same way as the Zend Platform bridge shown above (that is, as a connection between an Apache/PHP configuration and a Java EE Server). This bridge also works in an additional configuration: It can be deployed as a Java servlet, as shown in Figure 2.
To install the SourceForge Java Bridge:
Running SourceForge Java Bridge as a PHP servlet
In this configuration:
Helpful hints: