<?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>I want to be free &#187; wordpress</title>
	<atom:link href="http://i1t2b3.com/category/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://i1t2b3.com</link>
	<description>Any fool can make things bigger and more complex</description>
	<lastBuildDate>Wed, 28 Jul 2010 14:34:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=7619</generator>
		<item>
		<title>Several sites on single WordPress installation</title>
		<link>http://i1t2b3.com/2009/05/19/sites-on-single-wp-install/</link>
		<comments>http://i1t2b3.com/2009/05/19/sites-on-single-wp-install/#comments</comments>
		<pubDate>Mon, 18 May 2009 23:04:48 +0000</pubDate>
		<dc:creator>Skakunov Alexander</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[ideas]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://i1t2b3.com/?p=353</guid>
		<description><![CDATA[I have a couple of other WordPress blogs on the same server besides this one. One day I realised that all of them have 3 different WP versions and, as result, different admin areas which is not handy. I decided to make them use the same WordPress installation. Ok, first of all, I deleted wp-admin [...]]]></description>
			<content:encoded><![CDATA[<p>I have a couple of other WordPress blogs on the same server besides this one. One day I realised that all of them have 3 different WP versions and, as result, different admin areas which is not handy. I decided to make them use the same WordPress installation.</p>
<p>Ok, first of all, I deleted <code>wp-admin</code> and <code>wp-includes</code> folders and created new ones as symbolic links. Though the frontend worked well, I couldn&#8217;t log in into admin area, because the browser was redirected to that blog which was the base for all the rest for unknown reason.</p>
<p>The investigation shown, that admin area of WordPress is a separate sub-application, thing in itself, and in my case it resolves the absolute path to its source as the path to the base blog. I wanted each blog to use its own folder because there are config file and <code>uploads</code> folder.</p>
<p>It took me some time to find a solution. It requires two steps.</p>
<p>First, I added this line to the top of the <code>.htaccess</code> to make any PHP request to the blog (the blog front-end and the admin area scripts) call the same script before thier start:</p>
<pre><code class="apache">#fix for several sites on the same WP installation
php_value auto_prepend_file "/var/www/site_doc_root/prepend.php"
</code></pre>
<p>In this code <code>/var/www/</code> is the root folder for all my sites, and the <code>site_doc_root</code> is the document root of the current site (folder where all its files are located).</p>
<p>OK, the 2nd step &mdash; the contents of the <code>prepend.php</code> script. It is easy &mdash; it just must define an absolute path constant which is used all around the WordPress:</p>
<pre><code class="php">&lt;?php
define('ABSPATH', dirname(__FILE__).'/');
</code></pre>
<p>OK, after that I decided not to use one of the blogs as source for others, but download a fresh copy of WordPress and make it a source of the symbolic links for all my blogs. This helps to update them.</p>
<p>Then I deleted <code>wp-admin</code> and <code>wp-includes</code> folders and some wp-files and recreated them as symlinks. Attention to <code>wp-config.php</code> &mdash; don&#8217;t delete it, keep it unique for every site!</p>
<p>To make this task easier, I created <code>setup.sh</code> file, pasted the contents I show below, run this command</p>
<pre><code class="bash">chmod 755 setup.sh</code></pre>
<p>then I copied it in every site folder and launched there for every site:</p>
<pre><code class="bash">
ln -s /var/www/wordpress/wp-admin wp-admin
ln -s /var/www/wordpress/wp-includes wp-includes

ln -s /var/www/wordpress/wp-app.php wp-app.php
ln -s /var/www/wordpress/wp-atom.php wp-atom.php
ln -s /var/www/wordpress/wp-blog-header.php wp-blog-header.php
ln -s /var/www/wordpress/wp-comments-post.php wp-comments-post.php
ln -s /var/www/wordpress/wp-commentsrss2.php wp-commentsrss2.php
ln -s /var/www/wordpress/wp-config-sample.php wp-config-sample.php
ln -s /var/www/wordpress/wp-cron.php wp-cron.php
ln -s /var/www/wordpress/wp-feed.php wp-feed.php
ln -s /var/www/wordpress/wp-links-opml.php wp-links-opml.php
ln -s /var/www/wordpress/wp-load.php wp-load.php
ln -s /var/www/wordpress/wp-login.php wp-login.php
ln -s /var/www/wordpress/wp-mail.php wp-mail.php
ln -s /var/www/wordpress/wp-pass.php wp-pass.php
ln -s /var/www/wordpress/wp-rdf.php wp-rdf.php
ln -s /var/www/wordpress/wp-register.php wp-register.php
ln -s /var/www/wordpress/wp-rss.php wp-rss.php
ln -s /var/www/wordpress/wp-rss2.php wp-rss2.php
ln -s /var/www/wordpress/wp-settings.php wp-settings.php
ln -s /var/www/wordpress/wp-trackback.php wp-trackback.php
ln -s /var/www/wordpress/xmlrpc.php xmlrpc.php
</code></pre>
<p>That&#8217;s not all <img src='http://i1t2b3.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>I decided to update my WordPress installation every one or two months.</p>
<p>To do that, in the <code>/var/www/</code> folder (where all my sites reside) let&#8217;s create an update script <code>update_wordpress.sh</code> with the following contents:</p>
<pre><code class="bash">wget --timestamping http://wordpress.org/latest.zip
unzip -o latest.zip</code></pre>
<p>This will download a fresh copy of the wordpress if it&#8217;s changed (though wordpress team doesn&#8217;t show the file <code>Last-Modified</code> header, I think one day they will) and unzip it to <code>/var/www/wordpress/</code> folder which is the source for our symlinks.</p>
<p>Yes, you got it right &mdash; launching this script is all I need to update all my blogs.</p>
<p>Let&#8217;s make it periodic:</p>
<pre><code class="bash">crontab -e</code></pre>
<p>and then add this line to run the update process automatically every 1st day of every month at 9 AM:</p>
<pre><code class="bash">0 9 1 * * /var/www/update_wordpress.sh > mail -s "WordPress updated" your@email.com</code></pre>
<p>P.S. Of course, <noindex><a rel="nofollow" href="http://wordpress.org/download/svn/">SVN checkout</a></noindex> can be used for that purpose <img src='http://i1t2b3.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://i1t2b3.com/2009/05/19/sites-on-single-wp-install/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
