|
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
|
|
From: <php...@li...> - 2006-05-04 17:38:15
|
Hi, > the OCI8 extension, with the Oracle client installed [...] > cgi process (through Runtime.exec()). In CGIServlet thank you very much for this problem report. I have created a ticket for this, please see PR1481993: http://sourceforge.net/tracker/index.php?func=detail&aid=1481993&group_id=117793&atid=679233 > I created a simple patch to CGIServlet > $CGIEnvironment.setCGIEnvironment() What about changing setCGIEnvironment to protected Map getProcessEnvironment() {...} so that JDK 1.4 users can override it using a custom PhpCgiServlet or a custom PhpScriptEngine. The default implementation of getProcessEnvironment() would simply delegate to JDK1.5 System.getenv() using reflection: + try { + Method m = System.class.getMethod("getenv", EMPTY_PARAM); + Map map = (Map) m.invoke(System.class, EMPTY_ARG); + defaultEnv.putAll(map); + } catch (Exception e) {/*ignore*/} + return defaultEnv; Please see PR1481993 for details. > 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? I usually start php in FastCGI server mode outside of java, using the command: export X_JAVABRIDGE_OVERRIDE_HOSTS=/ php-cgi -b127.0.0.1:9667 AFAIK the FCGI server mode is currently not available on windows, but this might change in the future; the FCGI sapi is still being developed. Regards, Jost Boekemeier ___________________________________________________________ Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de |
|
From: <php...@li...> - 2006-05-04 19:18:55
|
On Thu, 2006-05-04 at 19:37 +0200,
php...@li... wrote:
> + try {
> + Method m = System.class.getMethod("getenv",
> EMPTY_PARAM);
> + Map map = (Map) m.invoke(System.class,
> EMPTY_ARG);
> + defaultEnv.putAll(map);
> + } catch (Exception e) {/*ignore*/}
> + return defaultEnv;
>
> Please see PR1481993 for details.
Thanks for the reply.
This looks like a good solution to me. I had only been concerned about
the path, but it seems appropriate to have the rest of the environment
available as well. This also seems like a good approach for JDK 1.4
compatibility, or in case you want to limit CGI access to the system
(you could override and supply a limited path, for example).
If you have a patch file, I would be happy to test it out.
> I usually start php in FastCGI server mode outside of
> java, using the command:
>
> export X_JAVABRIDGE_OVERRIDE_HOSTS=/
> php-cgi -b127.0.0.1:9667
>
> AFAIK the FCGI server mode is currently not available
> on windows, but this might change in the future; the
> FCGI sapi is still being developed.
>
Yes, the windows php-cgi.exe doesn't seem to recognize the "-b" flag.
Unfortunately my environment is currently limited to a windows server.
Hopefully that will change in the future as well. ;)
Let me know if there is anything else I can do to help.
Thanks,
Gary
|
|
From: <php...@li...> - 2006-05-08 17:26:22
|
Hi, > If you have a patch file, I would be happy to test > it out. a preliminary patch (not tested) is here: http://php-java-bridge.sourceforge.net/snaps/3.0.8.1/php-java-bridge_3.0.8_to_3.0.8.1.patch If you have CVS access, you can get the version via: cvs -d :pserver:ano...@cv...:/cvsroot/php-java-bridge co -rRelease-3-0-8 php-java-bridge I will test the new code next week and attach version 3.0.8.1 at the end of your ticket. Regards, Jost Boekemeier ___________________________________________________________ Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de |