|
From: <php...@li...> - 2006-05-02 18:30:38
|
Hi,
I have the PHP/Java bridge installed and working in standalone mode with
Apache Tomcat. The setup is:
* Tomcat 5.0.28 - handles all HTTP requests. PHP runs as a CGI
sub-component.
* Java webapp - contains PHP files, JavaBridge.jar, php-servlet.jar and
servlet mappings in web.xml.
* PHP 5.1.2 - installed under C:\php5 (instead of WEB-INF/cgi in the
webapp)
All of this works correctly for a simple php.ini configuration, and
simple tests like phpinfo().
However, this breaks when I try to configure the php.ini file to load
the OCI8 extension, with the Oracle client installed under
E:\oracle\ora92. It looks like the OCI8 extension is not able to see
the Oracle libraries in E:\oracle\ora92\bin. Note that the problem is
exclusive to the PHP/Java bridge -- PHP works from the command line with
OCI8.
I've tracked this down to a problem with the PATH being used for the PHP
cgi process (through Runtime.exec()). In CGIServlet
$CGIEnvironment.setCGIEnvironment(), no "PATH" entry is created in the
environment and so, on Windows, a limited default seems to be used (C:
\php5;C:\WINNT;C:\WINNT\system32).
I created a simple patch to CGIServlet
$CGIEnvironment.setCGIEnvironment(), which passes through a system
property as the PATH into the environment:
String systemPath = System.getProperty("system.path", "");
envp.put("PATH", systemPath);
Combining this with an a java argument to set the system property
("-Dsystem.path=%PATH%") seems to fix the problem and the oci8 extension
works with the Oracle client DLLs.
But is there a better way of handling this? Under linux I would use a
php-cgi.sh script to setup the path, but I don't know if there is a
similar way to handle this under Windows? Or if I am missing something
in the Windows configuration.
Any suggestions would be greatly appreciated.
Thanks,
Gary
|