quercus phpServlet使用有限制吗?

本站Google搜尋
訂閱本網站RSS
以電子郵件訂閱
訂閱文章RSS
每月文章彙整
2012 年 十二月 &(17)
2012 年 十一月 &(8)
2012 年 十月 &(14)
2012 年 九月 &(7)
2012 年 八月 &(12)
2012 年 七月 &(7)
2012 年 六月 &(5)
2012 年 五月 &(9)
2012 年 四月 &(9)
2012 年 三月 &(6)
2012 年 二月 &(2)
2012 年 一月 &(11)
2011 年 十二月 &(7)
2011 年 十一月 &(11)
2011 年 十月 &(8)
2011 年 九月 &(3)
2011 年 八月 &(4)
2011 年 七月 &(2)
2011 年 六月 &(5)
2011 年 五月 &(10)
2011 年 四月 &(5)
2011 年 三月 &(11)
2011 年 二月 &(8)
2011 年 一月 &(8)
2010 年 十二月 &(2)
2010 年 十一月 &(9)
2010 年 十月 &(5)
2010 年 九月 &(3)
2010 年 八月 &(8)
2010 年 七月 &(10)
2010 年 六月 &(12)
2010 年 五月 &(5)
2010 年 四月 &(9)
2010 年 三月 &(2)
2010 年 二月 &(15)
2010 年 一月 &(10)
2009 年 十二月 &(1)
2009 年 十一月 &(10)
2009 年 十月 &(6)
2009 年 九月 &(5)
2009 年 八月 &(2)
2009 年 七月 &(4)
2009 年 六月 &(7)
2009 年 五月 &(7)
2009 年 四月 &(11)
2009 年 三月 &(13)
2009 年 二月 &(9)
2009 年 一月 &(9)
2008 年 十二月 &(21)
2008 年 十一月 &(10)
2008 年 十月 &(14)
2008 年 九月 &(14)
2008 年 八月 &(16)
2008 年 七月 &(10)
2008 年 六月 &(12)
2008 年 五月 &(9)
2008 年 四月 &(24)
2008 年 三月 &(14)
2008 年 二月 &(10)
2008 年 一月 &(17)
2007 年 十二月 &(11)
2007 年 十一月 &(16)
2007 年 十月 &(24)
2007 年 九月 &(25)
2007 年 八月 &(25)
2007 年 七月 &(12)
2007 年 六月 &(15)
2007 年 五月 &(15)
2007 年 四月 &(31)
2007 年 三月 &(19)
2007 年 二月 &(15)
2007 年 一月 &(6)
2006 年 十二月 &(5)
2006 年 十一月 &(2)
2006 年 十月 &(9)
2006 年 九月 &(10)
2006 年 八月 &(11)
2006 年 七月 &(16)
2006 年 六月 &(14)
2006 年 五月 &(25)
2006 年 四月 &(7)
2006 年 三月 &(11)
2006 年 二月 &(21)
2006 年 一月 &(14)
2005 年 十二月 &(10)
2005 年 十一月 &(9)
2005 年 十月 &(10)
2005 年 九月 &(24)
2005 年 八月 &(32)
2005 年 七月 &(18)
2005 年 六月 &(34)
2005 年 五月 &(36)
2005 年 四月 &(44)
2005 年 三月 &(43)
2005 年 二月 &(43)
2005 年 一月 &(44)
2004 年 十二月 &(22)
2004 年 十一月 &(1)
12131415161718
19202122232425
2627282930
搜尋標籤雲
IT相關連結
簡睿的創作
| 點擊數: 1 / 3211
上周Caucho公司釋出了最新版的。由Resin 3.0.17開始,Resin裡多了一個稱為Quercus的東西,Quercus其實就是用Java實作的PHP語言模組。Resin的原作者Scott Ferguson說:
Quercus is Caucho’s cleanroom implementation of the PHP language written in Java. As a Java PHP implementation, it provides three primary benefits: allowing Resin to run PHP applications natively, giving PHP applications the stability and security of a Java application server, and letting Java applications use PHP as a presentation layer.
因此除了原有的XTP、JSP以外,我們也能在Resin上使用PHP來當做另一種展示層,而且「據說」Resin的PHP執行效能比Apache/mod_php高上數倍,另外,Caucho的()、()全部都是用Quercus在運作的,Wiki更是使用的PHP在執行的。
在Resin裡使用PHP的設定很簡單,就是設定一個QuercusServlet,再設一個Servlet-mapping以將*.php交給QuercusServlet處理即可。設定範例如下:
在webappsROOTWEB-INF目錄裡增加web.xml檔案,內容為:
<web-app xmlns="/ns/resin">
<servlet-mapping url-pattern="*.php"
servlet-class="com.caucho.quercus.servlet.QuercusServlet">
</servlet-mapping>
</web-app>
在webappsROOT裡新增HelloWorld.php檔案,內容為:
echo “Hello World";
在瀏覽器網址裡以 http://localhost:8080/HelloWorld.php 測試
其實是相當簡單的。這樣,似乎就能把Java和PHP整合起來了。
您可能也會有興趣的類似文章
(0則留言, )
(5則留言, )
(3則留言, )
(7則留言, )
(0則留言, )
(0則留言, )
(1則留言, )
(0則留言, )
(0則留言, )
(0則留言, )
(2則留言, )
(0則留言, )
(0則留言, )
(0則留言, )
(0則留言, )
隨機文章&(1)
歷史熱門文章November 06, PM
Has anyone run Phorum inside Quercus PHP? It's a Java EE web application environment that lets you run PHP systems inside a Java EE application server. I'm using JBoss and for a lot of other PHP systems, it works great-- but I'm having a small problem just with Phorum:
java.lang.NullPointerException
com.caucho.quercus.lib.UrlModule.urlencode(UrlModule.java:743)
com.caucho.quercus.lib.UrlModule.urlencode(UrlModule.java:733)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
com.caucho.quercus.module.StaticFunction.invoke(StaticFunction.java:120)
com.caucho.quercus.env.JavaInvoker.call(JavaInvoker.java:615)
com.caucho.quercus.env.JavaInvoker.call(JavaInvoker.java:488)
com.caucho.quercus.env.JavaInvoker.call(JavaInvoker.java:473)
com.caucho.quercus.env.JavaInvoker.callCopy(JavaInvoker.java:482)
com.caucho.quercus.expr.FunctionExpr.evalImpl(FunctionExpr.java:180)
com.caucho.quercus.expr.FunctionExpr.evalCopy(FunctionExpr.java:150)
com.caucho.quercus.expr.AssignExpr.eval(AssignExpr.java:86)
com.caucho.quercus.program.ExprStatement.execute(ExprStatement.java:64)
com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java:99)
com.caucho.quercus.program.IfStatement.execute(IfStatement.java:75)
com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java:99)
com.caucho.quercus.program.QuercusProgram.execute(QuercusProgram.java:239)
com.caucho.quercus.page.InterpretedPage.execute(InterpretedPage.java:61)
com.caucho.quercus.env.Env.include(Env.java:3500)
com.caucho.quercus.expr.IncludeOnceExpr.eval(IncludeOnceExpr.java:83)
com.caucho.quercus.expr.SuppressErrorExpr.eval(SuppressErrorExpr.java:91)
com.caucho.quercus.program.ExprStatement.execute(ExprStatement.java:64)
com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java:99)
com.caucho.quercus.program.QuercusProgram.execute(QuercusProgram.java:239)
com.caucho.quercus.page.InterpretedPage.execute(InterpretedPage.java:61)
com.caucho.quercus.page.QuercusPage.executeTop(QuercusPage.java:119)
com.caucho.quercus.servlet.QuercusServletImpl.service(QuercusServletImpl.java:163)
com.caucho.quercus.servlet.QuercusServlet.service(QuercusServlet.java:353)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
This happens only when I click on the &Edit users& link in the Admin console.
If you've seen this error before and know how to fix it-- reply here! :)
November 06, PM
What version of Phorum are you running inside this container? We have had some issues with memory usage for the users page in case there are
a lot of users. If you only have a few users then this can't be the issue. Anyway, if it is this problem, then using the latest 5.2 development release might be an idea. In that version we have implemented a better paging algorithm for the user page.
The java backtrace isn't really useful for us. It doesn't tell what part of the PHP code is causing the nullpointerexception. Maybe you could try debugging the code by putting die(&blah&); statements at various places in the include/admin/users.php script to find out at what line in the PHP code the java PHP container crashes. If we know the crash line number, we might be able to think of a reason why the java system chokes on it.
Maurice Makaay
Phorum Development Team
November 06, PM
It looks like a bug in Quercus when urlencode is given an empty $_REQUEST variable, I changed to code to guard the call to urlencode() to this (lines 192-196 of include/admin/users.php):
192 if ($_REQUEST[&search&]) { $url_safe_search=urlencode($_REQUEST[&search&]); }
193 if($_REQUEST[&posts&]) { $url_safe_search.=&&posts=&.urlencode($_REQUEST[&posts&]); }
194 if ($_REQUEST[&posts_op&]) { $url_safe_search.=&&posts_op=&.urlencode($_REQUEST[&posts_op&]); }
195 if ($_REQUEST[&lastactive&]) { $url_safe_search.=&&lastactive=&.urlencode($_REQUEST[&lastactive&]); }
196 if ($_REQUEST[&lastactive_op&]) { $url_safe_search.=&&lastactive_op=&.urlencode($_REQUEST[&lastactive_op&]); }
That gets past the null pointer exception in Quercus and the User admin page loads.
PS. This is Phorum 5.1.25 I'm using.
Edited 1 time(s). Last edit at 11/06/PM by sjanes71.
November 06, PM
This code might yield some PHP warnings. Try replacing that code block with the following:
$url_safe_search = '';
$f = array('search','posts','posts_op','lastactive','lastactive_op');
foreach ($f as $fld) {
if (isset($_REQUEST[$fld])) {
$url_safe_search .= &&$fld=&.urlencode($_REQUEST[$fld]);
Maurice Makaay
Phorum Development Team
November 08, PM
Now I've got a new error, this time running the 5.2.1-alpha and it starts to initialize the tables in admin.php.
Phorum Database Error
Sorry, a Phorum database error occurred.
Please try again later!
(0): SELECT * FROM phorum52_messages WHERE forum_id = 2 AND thread = 1 ORDER BY message_id
Backtrace:
Function phorum_database_error called at
{path to Phorum}/include/db/mysql/mysqli.php:168
Function phorum_db_interact called at
{path to Phorum}/include/db/mysql.php:1399
Function phorum_db_get_messages called at
{path to Phorum}/include/thread_info.php:42
Function phorum_update_thread_info called at
{path to Phorum}/include/admin/install.php:472
When I reload admin php, the error changes:
Phorum Database Error
Sorry, a Phorum database error occurred.
Please try again later!
(0): SELECT name, data, type FROM phorum52_settings
Backtrace:
Function phorum_database_error called at
{path to Phorum}/include/db/mysql/mysqli.php:168
Function phorum_db_interact called at
{path to Phorum}/include/db/mysql.php:377
Function phorum_db_load_settings called at
{path to Phorum}/common.php:191
Bummer. What changed with the database code between 5.1.25 and 5.2.1-alpha?
November 08, PM
Quotesjanes71Bummer. What changed with the database code between 5.1.25 and 5.2.1-alpha?
You mean apart from the total rewrite of the database layer? =)
Do you have the database error that occurs as well for us?
Maurice Makaay
Phorum Development Team
November 08, PM
The database error was 0--so the Quercus PHP query is returning 0 instead of undefined.
I &patched& mysqli.php with:
// Handle this error if it's not to be ignored.
if (! $ignore_error && $errno != 0)
Now the system sets up and creates the tables and initializes, but now doesn't save its settings-- admin.php always believes that the system is still waiting to be set up.
Now tracing that...
November 08, PM
seeing all the troubles you run into: how about just running apache with php alongside your java application server?
Seems like the php-implementation there is just crappy.
Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
November 08, PM
All the mysqli_* functions in front of that code return either TRUE, FALSE or a result object. FALSE is only returned if an error occurs in the queries. If your system is returning FALSE for succeeded queries, then things are terribly broken, possibly beyond patching. You are now continuing through the code with $res = FALSE. It's not a surprise that in that situation, the following code is not able to return data from tables. That following code really needs a sane $res.
Maurice Makaay
Phorum Development Team
November 08, PM
I'm planning on interfacing Phorum with some Java enterprise code in the very near future, and for some of the other applications I've been running, its been fine and there have been some nice bits of performance on the code that has been running.
I'm tracking down where the settings array isn't loading in the meantime, because it is creating the data without a problem.
November 08, PM
Quotesjanes71I'm tracking down where the settings array isn't loading in the meantime, because it is creating the data without a problem.
I already told you in this thread.
You broke the code =)
Maurice Makaay
Phorum Development Team
November 08, PM
LOL... naw...
Getting further. This time, the workaround is with mysqli_real_query-- Quercus PHP does not save the query result for the call that follows to mysqli_use_result. I modified the code to &save it for me& on the Phorum side.
Phorum is now loading but not authenticating the administrator from admin.php.
November 08, PM
Quotesjanes71 Phorum is now loading but not authenticating the administrator from admin.php.
Then check out how well that change works for you. Do you get records back at all in the queries? If your fix still looks like the one you posted before, then it will not work, because $res = FALSE. A Dutch saying comes to mind for this: &You cannot pick feathers from a bald chicken&.
BTW: did you already check if it works in case you make use of the &mysql& extension instead of the &mysqli& extension? Maybe the problem lies in the &mysqli& extension for your system?
Maurice Makaay
Phorum Development Team
Edited 1 time(s). Last edit at 11/08/PM by mmakaay.您所在的位置: &
在GAE上搭建PHP环境并开启URL重写
在GAE上搭建PHP环境并开启URL重写
GAE不直接支持php非常遗憾,但是可以利用Quercus来让GAE支持PHP,其原理是将php预编译为Java文件再执行。
1.下载quercus:
版本当然最新的最好,因为原则上来说新版本对php支援程度更高,但是在自己测试的时候发现最新的4.0.25存在一点问题,于是换用4.0.18版本.
选择WAR格式的文件下载,利用Winrar解压,将WEB-INF\lib\的jar拷贝至GAE工程下的war\WEB-INF\lib\目录
2.配置Quercus:
在appengine-web.xml中配置对php文件的支持:
&&&&&&path=&/**.php&&&&&&&&&&path=&/**.php&&&&
在web.xml中添加一个servlet:
&&&&&Quercus&Servlet&&&&&com.caucho.quercus.servlet.GoogleQuercusServlet&&
添加对php文件的映射:
&&&&&Quercus&Servlet&&&&&*.php&&
3.实现URL重写(通过UrlRewriteFilter实现):
下载UrlRewriteFilter,将urlrewritefilter-*.jar拷贝在工程的war\WEB-INF\lib\目录下
在web.xml中添加URL过滤
&&&&&&UrlRewriteFilter&&&&&org.tuckey.web.filters.urlrewrite.UrlRewriteFilter&&&&&&&UrlRewriteFilter&&&&&/*&&&&&REQUEST&&&&&FORWARD&&
在工程的war\WEB-INF目录下新建一个Url重写配置文件:urlrewrite.xml
&version=&1.0&&encoding=&utf-8&&&!DOCTYPE&urlrewrite&PUBLIC&&-//tuckey.org//DTD&UrlRewrite&4.0//EN&&&&&&&&&&&http://www.tuckey.org/res/dtds/urlrewrite4.0.dtd&&&&&&&&&&enabled=&true&&match-type=&regex&&&&&&&&UrlRewrite&&&&&&&&type=&request-filename&&operator=&notfile&&name=&notfile&&next=&and&&&&&&&&&type=&request-filename&&operator=&notdir&&name=&notdir&&next=&and&&&&&&&&/(.*)&&&&&&&&last=&true&&type=&forward&/index.php&&&&&&&&&
这条规则就等同于.htaccess中的:
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1
注意:这条规则可能会导致GAE本地管理http://localhost:8888/_ah/admin/失效,由于时间关系就不再修正.
在工程的war\目录下新建一个index.php文件:
&echo&'';&print_r($_SERVER);&&
由于我已经将index.php设置为welcome文件,所以直接打开http://localhost:8888/
效果如图所示:
498)this.width=498;' onmousewheel = 'javascript:return big(this)' src="/images//0485.png" alt="" style="margin: 0 padding: 0 border: 0 " />
附上一些参考资料:
//quercus-on-the-google-app-engine/
//quercus-on-google-app-engine/
http://tuckey.org/urlrewrite/#documentation
PHPer们还在犹豫什么,赶紧上吧~
原文链接:
【编辑推荐】
【责任编辑: TEL:(010)】
关于的更多文章
从程序员到项目经理,这个标题让我想起了很久以前一本书的名字《
网友评论TOP5
作为移动开发者,WOT2016移动互联网技术峰会,绝对有你不得不来的理由。
平年的9月13日和闰年的9月12日(每年的第256天)是程
移动互联网的投资机会到底还有哪些?移动互联网的下一
即将进入程序员这支队伍的大学生不在少数,你是否在即
本书是对Java EE各种技术之间互相协作的概览和补充。
本书还展示了如何编写JavaServer Page(JSP)页面或者企业级JavaBean(EJ
51CTO旗下网站}

我要回帖

更多关于 quercus 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信