Is Quercus a viable replacement for PHP in Java environments?
Asked Answered
E

5

14

For anyone stumbling upon this question who doesn't know what Quercus is - it is an implementation of PHP done in Java.

For a project that I am currently working on we serve php pages via cgi over servlets (I know it is clunky, but it is a requirement to support legacy code). I was excited to discover the Quercus project because it looked like a promising path to move our project to a more pure Java environment.

I have a few questions regarding Quercus:

  • Have you used Quercus in a shipping product?
  • How much of the php API is supported?
  • What are any gotchas you have had working with it?
  • Have you been able to make it work with Jetty? Have you ever heard of it working with Jetty? (I couldn't figure it out)
Eck answered 22/4, 2009 at 14:1 Comment(0)
A
7

I've tested it with WordPress and performance was almost double what a default WordPress install was under regular Apache/PHP. Which still isn't that great.

We did notice that while Quercus supports the curl commands in PHP, it doesn't support all the curl options. So automatic plugin downloads did not work. It wasn't that big of a deal, you can always download the plug-ins and install them manually. But this was a red flag since we didn't know what else would work. It also meant Facebook's PHP library wouldn't work right (most likely).

If you do a lot of database connections and calls, you should see a big performance boost in that area since database connection pooling will be used.

If you are writing the code, I would say it's a very viable option. Enough of PHP is supported that if you find something that doesn't work, you can use a different PHP command that is supported, or just use a Java command.

Argal answered 22/4, 2009 at 18:36 Comment(0)
R
4

I did a little work evaluating Quercus and it looked promising, but did not work with the project I was working on, as it was Symfony based and the reflective nature of Symfony was not well handled by Quercus.

I did try getting a number of open source PHP projects working with it and found it to have a fairly complete PHP5 based API.

You should be able to get it working with Jetty. I was able to get it working with Tomcat.

You can really think of it as a replacement for JSP in a Java app. The way it works parallels how JSP works in that you compile PHP to Java code, just as you'd compile JSP to Java code.

I believe the big disadvantage of going with Jetty would be the inability to precompile the PHP code.

There are quite a few advantages, though, even if you aren't mixing PHP with Java. If you are mixing the two, you have even more advantages.

Riding answered 22/4, 2009 at 18:23 Comment(0)
B
3

See link on how a developer managed to use Quercus to run PHP on the Google App Engine

NOTE: PHP is not officially supported in GAE but with Quercus you can run this now.

Barnes answered 27/4, 2009 at 16:30 Comment(0)
D
2

PHP performance will be good only in professional version of quercus. Because the professional version compiling the PHP code as java byte code. So it will be faster.

But the open source edition is still using the PHP interpreter as stated in http://en.wikipedia.org/wiki/Resin_Server

It seems there will be no performance boost up in open soruce edition.

Dominquedominquez answered 18/5, 2012 at 13:16 Comment(0)
B
0

Well, if you check the copyright at the bottom of the Quercus page you see it's updated until '06 so i don't garantee any PHP 5.x support.

But why would you even want to have the dual overhead like that? You can run java from php too :)

Bakery answered 22/4, 2009 at 14:48 Comment(1)
From what I have heard, quercus is faster for many things than native PHP.Domingodominguez

© 2022 - 2024 — McMap. All rights reserved.