• About this blog

    This blog features updates, opinions, and technical notes from Caucho engineers about Caucho products, the enterprise Java industry, and PHP. Caucho Technology is the creator of the Resin Application Server and the Quercus PHP in Java engine. A leader in Java performance since 1998, Caucho is a Sun JavaEE licensee with over 9000 customers worldwide.
  • Follow Caucho on Twitter

    • Tell us your thoughts about using IDEs with Resin: http://forum.caucho.com/showthread.php?t=16022 2010/08/26
    • Wondering if a CDI-based alternative to grails/roo has appeared. A groovy/CDI framework would be interesting. 2010/08/24
    • By open source experience, I mean contributions 2010/08/17
  • Tags

    ajaxworld apache bam candi cdi cloud cluster comet deploy devoxx eclipse embedded facebook flash flex google app engine hessian hmtp ioc javaone javazone jms marakana messaging mule newsletter nyjug osgi php pomegranate quercus resin resin 4.0 REST servlet sfjug silicon valley code camp training tssjs watchdog webbeans web profile websockets wordcamp wordpress
  • Meta

    • Register
    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org

Posts Tagged ‘php’

Using Google App Engine’s Datastore and Task Queues in PHP with Quercus

Friday, February 5th, 2010

I gave a talk Wednesday at the Silicon Valley Google Technology Users’ Group on using Quercus in the App Engine. One of the examples I gave was using the low-level data API from PHP and scheduling PHP “tasks” using Task Queues. I’ll walk through the source of that demo here to give you an idea of how Quercus makes it easy to mesh a Java platform with PHP code. At the end, I’ll also give you an idea of what the next steps would be to take this demo and use the techniques in a real application or framework.
(more…)

Tags: google app engine, google datastore, php, quercus
Posted in Engineering | 4 Comments »

Logging custom statistics in Resin

Monday, July 13th, 2009

Last week I was out of town doing some on-site training for a potential customer and they asked if it’s possible to log the number of threads active at any given time. We don’t do that as part of Resin normally, but it got me thinking that this should actually be very easy using our scheduled tasks and a PHP script to access our MBeans.
(more…)

Tags: jmx, php, resin, scheduled tasks
Posted in Engineering | 1 Comment »

Quercus compilation available for Tomcat in 4.0.1

Thursday, July 2nd, 2009

For version 4.0.1, we have added Quercus compilation support for other application servers including Tomcat, where before the interpreted mode was only available. The compiled mode is significantly faster than the interpreted mode (though the interpreted is still quite speedy compared to PHP on Apache). Quercus compilation will also work on Google App Engine, but there’s a requisite that files be pre-compiled.

(more…)

Tags: compilation, google app engine, php, quercus, tomcat
Posted in Announcements, Evangelism | 8 Comments »

Quercus on Google App Engine

Sunday, May 31st, 2009

quercusplusequalsheart-large

Ever since Google App Engine (GAE) supported Java, it has opened a slew of other languages that GAE indirectly and unofficially supports. PHP is one of them through Quercus, our 100% Java clean-room implementation of the PHP language.

(more…)

Tags: google app engine, google datastore, jpa, mysql, php, quercus, wordpress
Posted in Engineering | 23 Comments »

Pligg now runs on Quercus

Friday, October 31st, 2008

Over the last week, I had the pleasure of trying to get Pligg, a PHP content management system (CMS), to run on Quercus. It wasn’t easy due to a diabolical bug (more on that later), but it’s resolved for our upcoming 3.2.2 release and Pligg should run pretty swell.

So why another CMS? Quercus can already run Wordpress and Drupal, arguably the heavyweights in the PHP CMS arena. Well one of our good Resin users has over 50 Pligg sites and he wanted to migrate to Quercus. He had observed that PHP was being overloaded to such a point that all the linux swap space was being used up. So Quercus’ performance is very appealing to him. Checking my emails, it appears that he has been trying to run Pligg on Quercus for over a year :0. Talk about persistence and commitment!

The thing preventing him from running Pligg was that Pligg was reusing variables inside functions and declaring them global later on:

$a = "initial";
function test()
{
  $a = "changed";
  ...
  global $a;
  //$a here on out should be "initial"
  ...
}

Quercus is highly optimized and has optimizations for variables. If it sees the global statement inside a function scope, Quercus assumes that variable is global throughout the function. The issue was that any modifications to that variable was modifying it globally, when it should be modifying it locally, until the global statement is reached of course.

The question is: why would Pligg be reusing variable names and changing their scope? Why not use a different name? Why not put the global statement at the beginning of the function?

Sifting through their code, it appears that they eagerly initialize a copy of config objects. They do so by using includes. The includes store the results in a specific variable. So if you don’t want the includes to modify the global variable, then you better not have the global statement before these includes. We would never expect this, hence the Quercus bug. This is an example of unorthodox coding that PHP permits that we see all the time and it’s what makes it extremely difficult when we debug PHP applications.

Tags: php, Pligg, quercus
Posted in Announcements, Engineering | 2 Comments »

When and why to use Quercus

Thursday, August 28th, 2008

I’ve been working on finishing up the Resin administration training course and one of the subjects is “When and why to use PHP on a Java server”. Of course, I’m referring to Quercus and as I wrote this section, I realized some things about the PHP and Java open source communities.

Java’s open source community is most well known for producing great libraries and frameworks, while PHP’s is most well known for producing great applications. In Java, it’s often assumed that you’re paying someone to produce the application while in PHP it’s often that you’re not paying anyone or you simply don’t have time to write a custom application. With these things in mind, Java and PHP really can be viewed as complementary technologies. So when would you use them together?

  • When you need to get an application ready right away and there’s a popular PHP application available, but you’re a Java shop
  • You want to unify existing but separate PHP and Java deployments into one
  • Moving a PHP-only site to Resin for improved performance, reliability, and monitoring
  • You need PHP for the frontend and and Java libraries on the backend and you want them to be able to talk to each other easily

These are just a few of the examples that I came up with, but I’m sure there are more. What has your experience been?

Tags: php, quercus, resin, training
Posted in Evangelism | No Comments »

BAM update

Tuesday, June 10th, 2008

The last two weeks have been pretty engineering heavy for me, thus the slow pace of updates. ;-) What I’ve been working on are several BAM-related technologies. First, the Sudoku demo has been simplified and clarified. I’ll be writing a tutorial based on it soon which I’m also hoping to publish in the Flash & Flex Developers’ Magazine. Next, I’ve been working on building a PHP/BAM bridge. This is pretty exciting and shows the real power of Quercus: you can write true event-based programs in PHP. This is not something that is done easily or cleanly in the C implementation of PHP. The first example of this will be an XMPP chat server. Basically we’re moving PHP beyond the realm of simple HTTP web applications to have the full power of the Java platform.

Tags: bam, php, quercus, xmpp
Posted in Engineering | No Comments »


Caucho Technology is proudly powered by WordPress and Quercus®
Entries (RSS) and Comments (RSS).