You are here

java

Quercus

I've known about being able to run PHP under Java for a while now, but I've been a bit skeptical about how well it would actually run real PHP code.

Well, I've found out: really well. I've installed http://quercus.caucho.com/ on my Tomcat-6 server and run some of my simpler PHP5 stuff on it. It runs well, but not as fast as I was expecting (i.e. slower than Zend PHP5, for filesystem access at least). I suspect this is due to not having Resin Pro and thus not able to cache compiled PHP scripts. Maybe.

But it's certainly got my interest. I like Java a lot, but my main line of work is in PHP5 so I'm totally out of practise and well behind on the state of the art in Java (or even whatever was current 5 years ago..). Using the ability of Quercus to run Java within PHP5[1] I might look at rewriting some of my more time consuming PHP functions - something like what I used to do with C and assembler long, long ago - except that Java is more capable and faster, while assembler is faster but leaves you totally on your own when it comes to features.

As an aside, to get it to run on Tomcat ignore the web.xml on the Quercus website. Take the web.xml out of the downloadable quercus-3.x.x.war.

[1] I know about the PHP/Java bridge, but I never seem to have the right version of PHP to get it to compile...

Keywords: 

Eclipse

Eclipse is a Java oriented IDE, but one which is increasingly useful in my main line of work: PHP.

I recently moved wholesale from Dreamweaver to Eclipse (not by choice but by commerical necessity) and have found myself in a whole new world, one which I've pretty much ignored up until now. If I'd moved to Eclipse a year ago (when the PHP elements started to become useful) I really do think I would have been both more productive and also a better coder.

The main thing Eclipse has which Dreamweaver doesn't is code inspection and completion.

Example:
I have a class, such as:

class Basket
{
public $items;
}

In Dreamweaver, I'd need to remember that there is an attribute "$items" in Basket when typing $basket->items. But Eclipse knows about $items for me, and will hint to me that it's there when I type "$basket->". If I type "$basket->i", I can immediately hit tab to complete the line.

I've used these sorts of IDEs before (many years before, in fact) but had never even considered that it might apply to PHP. There are other major wins for Eclipse too, such as the SVN integration. This is massively more reliable than using Tortoise in the Windows shell as it will always ensure directory deletes and renames are notified to SVN. I usually remember to do these things myself, but there's more than just me in my team and I have spent a great many hours fixing SVN repositories after people have broken their directory layouts.

Keywords: 
Subscribe to RSS - java