main website home
  • 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.
  • Tags

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

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

Posts Tagged ‘Pligg’

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 »


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

  • HOME |
  • CONTACT US |
  • DOCUMENTATION |
  • BLOG |
  • WIKI 4 |
  • WIKI 3 |
  • Resin: Java Application Server
Copyright (c) 1998-2012 Caucho Technology, Inc. All rights reserved.
caucho® , resin® and quercus® are registered trademarks of Caucho Technology, Inc.
resin® is a cloud optimized, java® application server that supports the java ee webprofile ®