CloudBees focus on being the bleeding edge PaaS for Java, but please remember “Java” is used here as the name of the virtual machine, not the language. The JVM is able to host a large set of languages, including some unexpected ones like PHP!
Quercus is a PHP emulation / compiler for the JVM, that will bring Java power and facilities to PHP developers. Thanks to Java platform they can benefit enhanced performance (with the adequate compiler license), server features like session clustering and connection pooling, or even integrate with Java libraries and services.
I just setup a proof of concept deployment for a PHP application. I choose phpBB to get something more significant than just a simple HelloWorld.
First step is naturally to setup a repository for code. I’ve used github so that you can browse this sample project. Quercus is distributed as a war archive, I just expanded it at repository root so that I just can add PHP files like I’d do for an old-school FTP deployment on my favorite LAMP hosting.
I’ve added the adequate cloudbees-web.xml, so that my application can be deployed on RUN@cloud and access my MySQL database :
With a single line configuration in web.xml, Quercus will automagically redirects all mysql_connect() calls to my JDBC datasource, so that RUN@cloud connection pool will be used under the hood.
A simple Ant build script is used to assemble the war archive for deployment :
deploying a php app on cloudbees excludes="build/**/*" />
I’ve also created a Jenkins job on DEV@cloud and used the CloudBees deployer plugin to push the application on RUN@cloud as a continuous deployment process. You can see the application running at http://quercus.nicolas.cloudbees.net/
Note : by default, phpBB is using a configuration file stored on local file system, that will not be persisted as RUN@cloud is dynamically assigning physical resources, so I had to hack a preconfigured config.php script.