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/lib directory at the web application root, and place
Finally, create the
WEB-INF/web.xml file. The minimum file content will be something like the following:
<web-app> <servlet> <servlet-name>Quercus Servlet</servlet-name> <servlet-class>com.caucho.quercus.servlet.QuercusServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Quercus Servlet</servlet-name> <url-pattern>*.php</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.php</welcome-file> </welcome-file-list> </web-app>
If you have constructed a web application, you can configure WordPress. Copy
wp-config.php and edit it as necessary. If you need any
php.ini setting, create the
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.
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.
I made a plugin to make it possible. Please give me your feedback to make it better!
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.
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.