<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Again I go unnoticed &#187; Mediawiki</title>
	<atom:link href="http://www.thiswayup.de/schlagwoerter/mediawiki/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thiswayup.de</link>
	<description>me, my thoughts of flowers threwn</description>
	<lastBuildDate>Wed, 05 May 2010 19:14:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Running Mediawiki on Tomcat</title>
		<link>http://www.thiswayup.de/2010/04/running-mediawiki-on-tomcat/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=running-mediawiki-on-tomcat</link>
		<comments>http://www.thiswayup.de/2010/04/running-mediawiki-on-tomcat/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 06:44:58 +0000</pubDate>
		<dc:creator>tbk</dc:creator>
				<category><![CDATA[Codecrunch]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Mediawiki]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Quercus]]></category>
		<category><![CDATA[Tomcat]]></category>

		<guid isPermaLink="false">http://www.thiswayup.de/?p=915</guid>
		<description><![CDATA[The idea of running a PHP-Application on a Java application server might seem weird to most people &#8211; but if you have a working Java infrastructure and are familiar with setting up Tomcat this might be an option to avoid the &#8220;compiling PHP/Apache &#8211; hassle&#8221;. Follow my step-by-step guide to get Mediawiki up and running [...]]]></description>
			<content:encoded><![CDATA[<p>The idea of running a PHP-Application on a Java application server might seem weird to most people &#8211; but if you have a working Java infrastructure and are familiar with setting up Tomcat this might be an option to avoid the &#8220;compiling PHP/Apache &#8211; hassle&#8221;. Follow my step-by-step guide to get Mediawiki up and running on Tomcat.</p>
<p><span id="more-915"></span></p>
<h2>1. Install Resin Quercus</h2>
<p>Make sure you have a proper <a href="http://java.sun.com">JDK</a> and a recent <a href="http://tomcat.apache.org">Tomcat</a> installed. Download the <a href="http://caucho.com/download/quercus-4.0.3.war">latest Quercus Release</a> and extract it into a folder <code>mediawiki</code> the Tomcat&#8217;s <code>/webapps</code> folder (hint: it&#8217;s a ZIP-file, rename and unzip).</p>
<h2>2. Extract Mediawiki</h2>
<p>Download the <a href="http://download.wikimedia.org/mediawiki/1.15/mediawiki-1.15.3.tar.gz">latest Mediawiki</a> and extract in the <code>mediawiki</code> &#8211; Folder created in the last step. In your Tomcat installation, you should now have a <code>mediawiki</code> &#8211; folder in which you have a Mediawiki-Installation plus two special folders, <code>WEB-INF</code> and <code>META-INF</code>. Update the <code>web.xml</code> with the following bold part.</p>
<h2>3. Configure Quercus</h2>
<p>Quercus comes with a preconfigured <code>web.xml</code> in the <code>WEB-INF</code> &#8211; folder. We have to &#8220;pimp&#8221; it a little to make Mediawiki run properly.</p>
<p><code class="block">&lt;servlet&gt;<br />
    &lt;servlet-name&gt;Quercus Servlet&lt;/servlet-name&gt;<br />
    &lt;servlet-class&gt;com.caucho.quercus.servlet.QuercusServlet&lt;/servlet-class&gt;<br />
    &lt;!--<br />
      Tells Quercus to use the following JDBC database and to ignore the<br />
      arguments of mysql_connect(). We'll configure the MySQL database<br />
      pool in the next step.<br />
    --&gt;<br />
    <strong>&lt;init-param&gt;<br />
      &lt;param-name&gt;database&lt;/param-name&gt;<br />
      &lt;param-value&gt;jdbc/mediawiki&lt;/param-value&gt;<br />
    &lt;/init-param&gt;</strong><br />
  &lt;/servlet&gt;<br />
  &lt;!--<br />
    Tells the Quercus Servlet to parse all files ending on .php<br />
  --&gt;<br />
  &lt;servlet-mapping&gt;<br />
    &lt;servlet-name&gt;Quercus Servlet&lt;/servlet-name&gt;<br />
    &lt;url-pattern&gt;*.php&lt;/url-pattern&gt;<br />
  &lt;/servlet-mapping&gt;<br />
  &lt;!--<br />
    Tells the Quercus Servlet to parse all Requests starting with index.php/<br />
    We need this to support the pretty urls in Mediawiki<br />
  --&gt;<br />
  <strong>&lt;servlet-mapping&gt;<br />
    &lt;servlet-name&gt;Quercus Servlet&lt;/servlet-name&gt;<br />
    &lt;url-pattern&gt;index.php/*&lt;/url-pattern&gt;<br />
  &lt;/servlet-mapping&gt;</strong><br />
&lt;/servlet&gt;<br />
</code></p>
<h2>3. Configure MySQL as JNDI-Datasource in Tomcat</h2>
<p>In order to unleash the full power of a JEE-powered Mediawiki, we&#8217;ll configure a pooled MySQL datasource. In order to access MySQL from Tomcat, we need a proper MySQL database driver. <a href="http://www.mysql.com/downloads/connector/j/">Download it here</a> and place the contained <code>mysql-connector-java-5.1.12-bin.jar</code> in Tomcat&#8217;s <code>/lib</code> directory. Prepare a MySQL database to hold the Mediawiki database tables. Create a MySQL user if necessary.</p>
<p>Then place a file named <code>context.xml</code> in the <code>/webapps/mediawiki/META-INF</code> folder. Fill the variables with values matching your environment:</p>
<p><code class="block">&lt;?xml version="1.0" encoding="UTF-8"?&gt;<br />
&lt;Context&gt;<br />
  &lt;Resource name="jdbc/mediawiki" auth="Container"<br />
    type="javax.sql.DataSource"<br />
    maxActive="20" maxIdle="2" maxWait="10000"<br />
    username="&lt;&lt;MYSQL_USERNAME&gt;&gt;" password="&lt;&lt;MYSQL_PASSWORD&gt;&gt;"<br />
    driverClassName="com.mysql.jdbc.Driver"<br />
    url="jdbc:mysql://&lt;&lt;MYSQL_HOST&gt;&gt;:&lt;&lt;MYSQL_PORT&gt;&gt;/&lt;&lt;MYSQL_DATABASE_NAME&gt;&gt;"/&gt;<br />
&lt;/Context&gt;<br />
</code></p>
<h2>4. Run the Mediawiki-Installer</h2>
<p>Fire up Tomcat and go to <a href="http://localhost:8080/mediakwiki/config/index.php">http://localhost:8080/mediakwiki/config/index.php</a>. Follow the installation steps of Mediawiki. For debugging purposes place a <code>phpinfo.php</code> file in the <code>/webapps/mediawiki</code> folder:</p>
<p><code class="block">&lt;?php<br />
  phpinfo();<br />
?&gt;</code></p>
<p>Enjoy! In the next post I&#8217;ll write some lines about Single-Sign-On with NTLM and Tomcat/Apache/Mediawiki.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thiswayup.de/2010/04/running-mediawiki-on-tomcat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

