Skip to content

Deploying WordPress with Quercus

Quercus is a PHP implementation written in Java. By using it, you can even deploy WordPress on a Java EE web application server, but its author Caucho Technology provides little information about how to do it. This post tries to provide the missing information for new users.

Getting Quercus and WordPress

First, you must get the archives of Quercus and WordPress. For WordPress, just download it from its home site. (The author fails to run WordPress 4.0 with Quercus, but YMMV.)

To get Quercus, download a WAR archive from its home site, but to deploy WordPress with it, you must extract a JAR archive of Quercus from the WAR. Since a WAR archive has the same internal structure with ZIP, you can any unzip tool to extract files from it. What you need is quercus.jar and should be found in the WEB-INF/lib directory in the WAR archive.

You will also need a MySQL JDBC driver, but this post does not describe how to install the driver to your web application server.

Constructing a web application

If you have got Quercus and WordPress, you can now construct a web application for WordPress. If you extract files the WordPress archive, you will see all files are contained in a directory named wordpress. Just copy all the files and subdirectories in the wordpress directory to the web application root directory, not the directory itself.

Then, create the (WEB-INF and) WEB-INF/lib directory at the web application root, and place quercus.jar there.

Finally, create the WEB-INF/web.xml file.  The minimum file content will be something like the following:

    <servlet-name>Quercus Servlet</servlet-name>
    <servlet-name>Quercus Servlet</servlet-name>

Configuring WordPress

If you have constructed a web application, you can configure WordPress. Copy wp-config-sample.php to wp-config.php and edit it as necessary. If you need any php.ini setting, create the WEB-INF/php.ini file.

If you would like to use a JNDI DataSource by the Quercus’s database parameter, make sure your MySQL JDBC driver uses the ISO8859_1 encoding to suppress character encoding conversion in the driver. Otherwise, all non-ASCII characters might not be displayed correctly. This is because Java assumes Unicode strings while PHP assumes multibyte-encoded ones, and because WordPress assumes the encoding conversion will take place on the MySQL server. By specifying ISO8859_1 as the character encoding, the driver will mostly pass through PHP strings to/from the server where conversion is executed.

Enabling Permalinks

The steps described above should make WordPress run on a Java EE web application server, but pretty permalinks will not work without further configuration. Any configuration for WordPress on PHP (mostly) will not work as your WordPress is on a Java web application server. If you want pretty permalinks, take a look at Pretty Permalink Filter as an additional configuration option. It was written exactly in order to make pretty permalinks work with WordPress on a Java EE web application server.

You Can Now Login to Hudson CI Server with Your Google Account

I made a plugin to make it possible. Please give me your feedback to make it better!

Tool Labels Plugin 2.0 for Hudson & Jenkins

I just released Tool Labels Plugin 2.0 both for Hudson and for Jenkins this time. I hope you can see it on the Update Center soon.

To describe the plugin for those who do not know it yet, it allows Hudson or Jenkins users to add labels dynamically to every node with a specific tool installation. For example, if you need to build or test your software with JDK 1.6 but you do not want to install such an old version automatically installed on many nodes, you can add jdk1.6 as a label to the JDK 1.6 installation. Then, if you set the tool path of JDK 1.6 on the nodes on which it is installed, those nodes will have jdk1.6 dynamically as a label and you can restrict nodes to run your job by that label.

Of course, this plugin is not limited just to JDK. You can use it for Maven, Ant, MSBuild, or any other tool if you can set tool paths for it per node.

RAD Studio Plugin for Jenkins

I am now working on RAD Studio Plugin for Jenkins. It will help you build and test your RAD Studio projects on Jenkins, a widely used open-source continuous integration (CI) server application.

The plugin should soon be available in the Update Center of your Jenkins server instance. If you are interested in the project itself or in its source code, please watch its source code repository on Bitbucket.

Too Hard To Deploy Apache Archiva

I challenged to deploy Apache Archiva on GlassFish 4.1 for a couple of days but I finally postponed the work since the problems seemed too complex. I will retry it later when I have free time.

Building Quercus with Java SE 8

My Maven project to build Quercus from its source code was just updated for Java SE 8 JDK. The project repository is available on Bitbucket and its latest stable build should be available from my Jenkins CI service.

Running Quercus On GlassFish Server 4

I tried to migrate one of my Quercus-powered web applications to a new GlassFish Server 4 instance, but failed at first.  GlassFish complained with a server log entry like the following:

The lifecycle method [init] must not throw a checked exception. Related annotation information: annotation [@javax.annotation.PostConstruct()]…

So what was a checked exception, I thought and got an answer in a few minutes.

To explain a checked exception in short, it is an exception (java.lang.Throwable and its descendants) that is not an unchecked exception (java.lang.RuntimeException and its descendants). The @javax.annotation.PostConstruct annotation simply requires the annotated method does not throw a checked exception, but Quercus violates the requirements.

It became clear that I could not use Quercus on GlassFish Server 4 without modifications, so I decided to build Quercus myself from the source code.

I made a Maven project for Quercus, but the first apparent issue was its dependencies are not clear. I tried to add possible dependency to resolve errors, but a few remained. One of the causes was Quercus happened to use a draft version of the Java Caching API that is not compatible to the final release. I decided to go with the final release and made trivial changes to the Quercus source code. Another one is a bug in the Java EE API available from the Maven repository. I finally added explicit dependency on the CDI APIs to work around it.

(To be continued to Episode 2)


Get every new post delivered to your Inbox.

Join 88 other followers