tags:

views:

623

answers:

4

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)
A: 

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 :)

SchizoDuckie
apparently there is a php5 version here: http://quercus.caucho.com/
Tom Haigh
From what I have heard, quercus is faster for many things than native PHP.
jsight
+3  A: 

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.

Tim
+3  A: 

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.

Brent Baisley
+3  A: 

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.

TopPot