From: <php...@li...> - 2006-10-06 13:29:01
|
anybody? -----Original Message----- From: Mike D'Ambrogia [mailto:mi...@ja...] Sent: Tuesday, October 03, 2006 12:55 PM To: 'php...@li...' Subject: tomcat - using php4 running TomCat 5 on Windows 2k, I've got the app up and running but the test page shows that the version of php is php5 but I'd rather run php4. The php/java bridge docs read vague to me (new to this) about how I can config the bridge to run PHP 4 vs 5 without rebuilding the app. I don't want to run the slower pure PHP implementation any reference doc that someone can point me to that would show me the config setup for running php4? thx mike |
From: <php...@li...> - 2006-10-06 16:49:09
|
Hi, please excuse the delay. I assume you're running setup #6 (see http://php-java-bridge.sourceforge.net/README). It is possible to adjust the php_exec option, see WEB-INF/web.xml. It defaults to WEB-INF/cgi/php-cgi-<arch>-<os>, which is PHP 5.1. You can set it to c:/php-cgi.exe for example. > don't want to run the slower pure PHP implementation The pure PHP implementation needs PHP >= 5 anyway. When you use an accelerator technology, the pure PHP implementation isn't much slower than the C-based implementation. Round-trips are most expensive, but they can eliminated by sending the Java() statements in a single stream, e.g.: java_begin_document(); java statements; java_end_document(); So I think the lack of performance is not a good argument to dismiss the pure PHP implementation. :) Regards, Jost Boekemeier ___________________________________________________________ Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de |
From: <php...@li...> - 2006-10-06 17:44:28
|
>please excuse the delay. No problem, appreciate the reply/info >I assume you're running setup #6 (see http://php-java-bridge.sourceforge.net/README). Yes, standalone Tomcat 5.0.28 on Win2k > It is possible to adjust the php_exec option, see WEB-INF/web.xml. It defaults to > WEB-INF/cgi/php-cgi-<arch>-<os>, which is PHP 5.1. You can set it to > c:/php-cgi.exe for example. I cannot find any file in the php release named 'php-cgi.exe'. I believe that php-cgi.exe is php5... I've tried using a path to the cli (c:/php/cli/php.exe) version and the cgi (c:/php/php.exe) version of php.exe in the C:\Apache\Tomcat\webapps\JavaBridge\WEB-INF\web.xml file (uncommented lines 58-61, and updated the value) but both result in an exception when I try to run the test.php page: HTTP Status 500 - type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception javax.servlet.ServletException: String index out of range: -1 php.java.servlet.PhpCGIServlet.doGet(PhpCGIServlet.java:567) javax.servlet.http.HttpServlet.service(HttpServlet.java:689) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) root cause java.lang.StringIndexOutOfBoundsException: String index out of range: -1 java.lang.String.substring(String.java:1444) php.java.servlet.CGIServlet$CGIEnvironment.init(CGIServlet.java:563) php.java.servlet.PhpCGIServlet.createCGIEnvironment(PhpCGIServlet.java:4 30) php.java.servlet.CGIServlet.doGet(CGIServlet.java:448) php.java.servlet.PhpCGIServlet.doGet(PhpCGIServlet.java:535) javax.servlet.http.HttpServlet.service(HttpServlet.java:689) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs. I'm obviously still missing something, any ideas? Mike |
From: <php...@li...> - 2006-10-07 16:42:49
|
Hi, > I cannot find any file in the php release named > 'php-cgi.exe'. I It is called php-cgi-x86-windows.exe. > using a path to the cli Doesn't work. The command line interface only works on the command line. :) You need the php-cgi.exe. > version and the cgi > (c:/php/php.exe) version of > php.exe in the Are you sure that php.exe is a cgi binary? IMHO the cgi binary is called php-cgi.exe. However, I think it is best to download and to install the php integration kit for windows and use the launcher.exe so that the PHP/Java Bridge can use the FastCGI interface instead of CGI: http://www.alphaworks.ibm.com/tech/phpintwasce/download Basically the windows version of PHP has been compiled without a standalone fast cgi server; the -b flag is missing in the windows php binary. Until the PHP people add this capability to the windows version of php, the above launcher.exe is required to run PHP efficiently on windows. > it from fulfilling this request. > exception > javax.servlet.ServletException: String index out of > range: -1 This probably means that no HTTP header fields were sent, which may mean that the bridge uses the CLI instead of the CGI version of PHP. Regards, Jost Boekemeier ___________________________________________________________ Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de |
From: <php...@li...> - 2006-10-09 18:23:03
|
>> I cannot find any file in the php release named 'php-cgi.exe'. >It is called php-cgi-x86-windows.exe. I've edited web.xml and added a path to php-cgi-x86-windows.exe within the php_exec params, restarted TC but still have the same 500 error > Are you sure that php.exe is a cgi binary? IMHO the cgi binary is called php-cgi.exe. Downloaded PHP 4.4.4 from php.net and there is no file inside the release named php-cgi.exe > However, I think it is best to download and to install the php integration kit for windows and use the launcher.exe so that the PHP/Java Bridge can use the FastCGI interface instead of CGI: http://www.alphaworks.ibm.com/tech/phpintwasce/download Ok, I've got the kit downloaded, copied only launcher.exe into the webapps/JavaBride/WEB-INF/cgi dirand have updated the php_exec param in webapps/JavaBridge/web.xml to point to launcher.exe, restarted TC and end up with the same 500 problem Is there a config parameter that I'm missing? Am I the only one trying to run the bridge within a TC/Win2k env? Mike |
From: <php...@li...> - 2006-10-10 16:29:34
|
Hi Mike, thank you very much for this bug report. I haven't looked carefully enough at the error message you've given. The exception is caused by a bug in the CGIServlet, which requires a File.separator instead of a slash. I have created a ticket for this bug, please see http://sourceforge.net/tracker/index.php?func=detail&aid=1574648&group_id=117793&atid=679233 As a workaround please use a backslash to specify the path, e.g.: c:\windows\php.exe I will check this with the author of the CGIServlet so that we can publish an updated PHP/Java Bridge in december. Regards, Jost Boekemeier ___________________________________________________________ Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de |
From: <php...@li...> - 2006-10-10 16:40:16
|
You think it's a bug vs. "pilot error" on this end? I'll try the backslashes and get right back to you Mike |
From: <php...@li...> - 2006-10-11 19:27:40
|
On the forward slashes, turns out you might have been on to something there. Chgd web.xml to use back slashes and got some different results When set to: <init-param> <param-name>php_exec</param-name> <param-value>C:\Apache\Tomcat\webapps\JavaBridge\WEB-INF\cgi\php-cgi-x86 -windows.exe</param-value> </init-param> I get a phpinfo page with "PHP Version 5.1.3-dev" in the header, and 21 instances of 'php-cgi-x86-windows' (no .exe or .dll extension listed..) running in in my task manager window. If I shut TC down then they terminate correctly as well. This is progress Now I'm fishing around abit to see if I can stumble across a solution, I try 'php-4-java-x86-windows.dll' in place of php-cgi-x86-windows.exe in the web.xml param-name value. Restart TC and get: javax.servlet.ServletException: An IO exception occured. Probably php was not installed as "/usr/bin/php-cgi" or "c:/php/php-cgi.exe" or "C:\Apache\Tomcat\webapps\JavaBridge\WEB-INF\cgi\php-cgi-x86-windows[.sh ]|[.exe]". Please see "php_exec" in your WEB-INF/web.xml and WEB-INF/cgi/README for details. php.java.servlet.PhpCGIServlet.doGet(PhpCGIServlet.java:546) javax.servlet.http.HttpServlet.service(HttpServlet.java:689) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) Makes sense, it seems to need an executable of some sort. The only other .exe file that I have in the cgi dir is the launcher.exe file that I copied in from the IBM link you provided. Changing web.xml to use that results in the test.php page hanging with out reloading and 52 instances of php.exe running and visible in the task manager window. Stopping TC does not terminate the 52 instances of php.exe So I try c:\php\php.exe in web.xml and get "Fatal: The loaded java extension is not the PHP/Java Bridge" with 20 instances of php.exe running. Stopping TC terminates the php.exe instances correctly Copy php.exe from c:\php to the cgi subdir and repath the web.xml file and I get: PHP 4.4.2 too old. For PHP versions < 5.1.4 install the PECL extension, see INSTALL document from http://php-java-bridge.sourceforge.net/INSTALL. Or set the path to the PHP executable, see php_exec in the WEB-INF/web.xml Hmm, running php.exe from 4.4.4 Try the url in the error msg above and search it for PECL without luck, tried copying php_java.dll and php_java.jar into the cgi subdir alongside php.exe, but the only way to get something that is close to working is to set the param-name value to php-cgi-x86-windows.exe, but it reports 5.1.3 Hope this helps Mike |
From: <php...@li...> - 2006-10-14 15:06:49
|
Hi, [please excuse the delay] I am sorry, but I could not reproduce this problem with php 4. I have installed the latest tomcat version (http://ftp.uni-erlangen.de/pub/mirrors/apache/tomcat/tomcat-5/v5.5.20/bin/apache-tomcat-5.5.20.exe) and downloaded and copied the current PHP/Java Bridge ("JavaBridge.war") into C:\Programme\Apache Software Foundation\Tomcat 5.5\webapps downloaded and extracted the current PHP4 version to c:\php and changed C:\Programme\Apache Software Foundation\Tomcat 5.5\webapps\JavaBridge\WEB-INF\web.xml to <init-param> <param-name>php_exec</param-name> <param-value>C:\php\php.exe</param-value> </init-param> After that I was able to run PHP4 applications within tomcat. The only problem I see is that the documentation shows forward slashes, which is something that doesn't work on windows. But this is a minor problem, imho. > Now I'm fishing around abit to see if I can stumble > across a solution, I > try 'php-4-java-x86-windows.dll' in place of > php-cgi-x86-windows.exe in > the web.xml param-name value. Restart TC and get: You don't need a php_java.dll to run php from java. The PECL extension is only necessary for PHP4 and only if you want to embed java statements into your PHP pages. > So I try c:\php\php.exe in web.xml and get "Fatal: > The loaded java > extension is not the PHP/Java Bridge" That's okay, see above. You probably use an old version of the PECL extension. > PHP 4.4.2 too old. > For PHP versions < 5.1.4 install the PECL extension, Yes, the pure PHP implementation currently only works with php 5.1.4 or above. If you want to embed java statements into your php pages, you must install the PECL extension from sourceforge. > Try the url in the error msg above and search it for > PECL without luck The PECL extension is packaged within the JavaBridge.war. > tried copying php_java.dll and php_java.jar These versions are 4 years old and don't work anymore. Don't use them. Please use the most recent versions of the PHP/Java Bridge and the PECL extension. Regards, Jost Boekemeier ___________________________________________________________ Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de |
From: <php...@li...> - 2006-10-16 23:34:45
|
Figured out the disconnect and why it wasn't "working" for me... Turns out that it seems I had the configuration correct at one point, the browser reporting back the message re: PECL required, along with your note about PECL "If you want to embed java statements into your php pages, you must install the PECL extension from sourceforge." turned out to be the final clue for me and in hindsight was actually working at that time. I had assumed, based on the browser output of the phpinfo()-like information, that the test.php file contained only one line and that line had phpinfo() on it. A bad assumption in hindsight. I opened the test.php file and saw calls to java includes and then made up a .php file that had the phpinfo() function as the only line in the file. Viola, I had 4.4.4, and even 4.4.2 when I pointed the bridge to use my old version of php. So the disconnect was that the test.php file didn't run off the bat, yet php support was enabled. Next step is to enable support for 4.4.x so that I can call java servlets and capture return values in my php pages >>If you want to embed java statements into your php pages, you must >>install the PECL extension from sourceforge. Couldn't find a PECL extension on sourceforge - do you have a URL/instructions? I use PEAR but am not familiar with PECL |
From: <php...@li...> - 2006-10-18 17:36:38
|
Hi, > >>If you want to embed java statements into your php > pages, you must > >>install the PECL extension from sourceforge. > > Couldn't find a PECL extension on sourceforge - do > you have a > URL/instructions? I use PEAR but am not familiar > with PECL It is called php-4-java-x86-windows.dll and is stored in the WEB-INF/cgi folder within the JavaBridge.war. The README contained in the same folder has some information how to set it up. Basically you need to rename the above dll to php_java.dll, copy it to your php extension_dir and add a extension=php_java.dll [java] to your php.ini. Regards, Jost Boekemeier ___________________________________________________________ Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de |
From: <php...@li...> - 2006-10-19 05:04:31
|
Winner Thanks for your patience and help in getting thru this issue |