<?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>workbench @ haefelinger.it &#187; admin</title>
	<atom:link href="http://workbench.haefelinger.it/archives/category/admin/feed" rel="self" type="application/rss+xml" />
	<link>http://workbench.haefelinger.it</link>
	<description>Notes, thouhts and other stuff on software development</description>
	<lastBuildDate>Wed, 07 Apr 2010 07:02:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Adding A Plesk Event Handler</title>
		<link>http://workbench.haefelinger.it/archives/177</link>
		<comments>http://workbench.haefelinger.it/archives/177#comments</comments>
		<pubDate>Thu, 25 Feb 2010 15:46:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[plesk]]></category>

		<guid isPermaLink="false">http://workbench.haefelinger.it/?p=177</guid>
		<description><![CDATA[Plesk allows you to have a customized event handler. This is a rather useful feature cause it allows you to customize the way Plesk behaves. Take the meanwhile famous vhost_ssl.conf bug. Although documented in the manual, Plesk will not recognize an additional configuration file for an SSL/TLS port in a subdomain. Solutions have been proposed [...]]]></description>
			<content:encoded><![CDATA[<p>Plesk allows you to have a customized event handler. This is a rather useful feature cause it allows you to customize the way Plesk behaves. Take the meanwhile famous <code>vhost_ssl.conf </code>bug. Although documented in the manual, Plesk will not recognize an additional configuration file for an SSL/TLS port in a subdomain. Solutions have been proposed to manually change vhost.conf. That&#8217;s a forbidden fruit however, cause all it needs is a <code>websrvmng --reconfigure-all</code> to eliminate your changes. But as mentioned, just install a event handler which is triggered when a subdomain is created or updated. Such an event handler can be just a plain shell script.</p>
<p>However, when I tried to install such an event handler beast via <code>Plesk | Server | Event Handler | Add New Event Handler</code> I ended up in an error message like <code>Error: Some fields are empty or contain an improper value</code> for which add did not have any explanation. Much, very much later, I discovered that I had copied the path of my script to be executed via copy-n-paste into that Plesk command field. That copy contained whitespace at the end of the command, i.e. something like</p>
<pre>
/path/to/handler.sh\n
</pre>
<p>which is enough to make Please grumpy. What&#8217;s more, it&#8217;s all about whitespace (blanks, tabs, newline etc) at the end of a command while whitespace within the command is accept without any rumble:</p>
<pre>
echo > /dev/null
</pre>
<p>That works fine. </p>
<p><strong>Summary: </strong></p>
<blockquote><p>When entering an event handler command, make sure that there is no whitespace at the end of the command.
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://workbench.haefelinger.it/archives/177/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MacPorts, MySQL, PHP5 and that socket thing ..</title>
		<link>http://workbench.haefelinger.it/archives/162</link>
		<comments>http://workbench.haefelinger.it/archives/162#comments</comments>
		<pubDate>Sat, 13 Feb 2010 20:36:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[macosx]]></category>
		<category><![CDATA[macports]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://workbench.haefelinger.it/?p=162</guid>
		<description><![CDATA[I&#8217;m using MacPorts to have a variety of Open-Source software on my computer. Amongst them MySQL and Apache&#8217;s web server with PHP. In addition I&#8217;m also running Wordpress, a popular blog software, and  Mediawiki, the software behind Wikipedia. Both applications are written in PHP and can be configured to use MySQL as database. 
I [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m using MacPorts to have a variety of Open-Source software on my computer. Amongst them MySQL and Apache&#8217;s web server with PHP. In addition I&#8217;m also running Wordpress, a popular blog software, and  Mediawiki, the software behind Wikipedia. Both applications are written in PHP and can be configured to use MySQL as database. </p>
<p>I install those two web applications myself rather than using MacPorts to do so. The installation is basically nothing more than unzipping the distribution package and to modify the configuration files to make sure they connect to my MySQL database on my <em>localhost</em>. However, while installing Wordpress went smooth, I run into <em>database connection failures</em> when installing Mediawiki. It took me some time to figure out what is going on here.</p>
<p>If you have weird connection problems using PHP and MySQL then try one or both of the following solutions:</p>
<ul>
<li><strong>Solution</strong>: Use <code>127.0.0.1</code> instead of <code>localhost</code> as host of your MySQL database server. This has a rather surprising effect, see below.
</li>
<li><strong>Solution</strong>: Change your PHP&#8217;s configuration file, which is  <code>/opt/local/etc/php5/php.ini</code>, to contain the following two lines:
<ol>
<li>Tell PHP about the Unix domain socket to use
<pre>
   mysql.default_socket = /opt/local/var/run/mysql5/mysqld.sock
</pre>
</li>
<li> In addtion make sure that PHP&#8217;s save mode is off (notice that this feature has been deprecated and removed in PHP 6), otherwise your previous modification will be gracefully ignored:
<pre>
    safe_mode = Off
</pre>
</li>
</ol>
<p>Notice that in addition you need to <strong>restart your Apache web server</strong> so that your changes are taken into account. You can do that with <code>apachectl restart</code>.
</li>
</ul>
<h4>Background Information</h4>
<p>Neither Mediawiki nor Wordpress (nor most other PHP based web application accessing MySQL) implement the gory details how to connect to a database. Usually they just delegate this to <code>mysql_connect();</code>, a API function provided by PHP.</p>
<p>PHP in turn uses the functionality of a (shared) library provided by MySQL, i.e. the MySQL driver. MySQL allows you to connect to the database via <strong>two routes</strong>:</p>
<ol>
<li>via <strong>Internet sockets</strong> (TCP/IP); and via</li>
<li><strong>UNIX domain sockets</strong></li>
</ol>
<p>So, how does one choose between this two routes? The answer is rather surprising. MySQL decided to give <em>localhost</em> a new meaning. If you specify <code>localhost</code>, then the UNIX domain socket route is chosen. If you say <code>127.0.0.1</code> instead, then you connect via an Internet socket. While this is probably the most natural thing for those MySQL folks, it&#8217;s a rather confusing fact for all other humans. It is rather carved deep in our brain for years now that  <code>127.0.0.1</code> and <code>localhost</code> is the same thing.</p>
<p>After I have changed both Mediawiki and Wordpress to use <code>localhost</code> I had for the first time a situation where both web applications behaved in the very same way. <em>They both did not work</em>. Then, when I changed to <code>127.0.0.1</code>, both worked fine. Btw, notice that <code>localhost</code> is the default <em>hostname</em> used by Mediawiki while  <code>127.0.0.1</code> is the default <em>host</em> suggested by Wordpress.</p>
<p>Using <code>127.0.0.1</code> is usually fine, however I <strong>do want</strong> to use the UNIX socket and I was wondering what went wrong.</p>
<p>The problem is that MacPorts MySQL port patches the original MySQL sources to use socket <code>/opt/local/var/run/mysql5/mysqld.sock</code> instead <code>/tmp/mysql.sock</code>. This change is not particular well documented. One would assume that this kind of change goes into an appropriate <code>my.conf</code> configuration file. That&#8217;s actually not the case. Even worse, MacPorts MySQL port does not even ship with such a configuration file. </p>
<p>Changing the default socket location is one thing, not telling us and the PHP5 maintainer this is another sin. So, while MySQL happily uses that weird socket location, PHP5 still expects <code>/tmp/mysql.sock</code>. In other words, PHP and MySQL are not working out of the box when using MacPorts. At least not when relying on Unix domain sockets. It does work when using Internet domain sockets cause that default port, being 3306, has not changed. Btw, the MacPorts maintainer of PHP and MySQL is one and the same person. Sounds familiar? Yes, I also have been thinking about <em>Dr. Jekyll and Mr. Hyde</em>. No serious. I assume that there is a serious reason why this does not work out of the box as we all wish. I just don&#8217;t get it.</p>
]]></content:encoded>
			<wfw:commentRss>http://workbench.haefelinger.it/archives/162/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Plesk</title>
		<link>http://workbench.haefelinger.it/archives/156</link>
		<comments>http://workbench.haefelinger.it/archives/156#comments</comments>
		<pubDate>Fri, 12 Feb 2010 11:17:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[apache httpd]]></category>
		<category><![CDATA[plesk]]></category>
		<category><![CDATA[apache_httpd]]></category>

		<guid isPermaLink="false">http://workbench.haefelinger.it/?p=156</guid>
		<description><![CDATA[Plesk is kind of freaky creature. Working with it can be a frustrating experience. Not when working with the graphical web interface. Used in that way, it&#8217;s easy to create/modify/remove sub-domains and other important tasks. However, the guys from Paralles do not expect apache to server something else than static pages. How else can it [...]]]></description>
			<content:encoded><![CDATA[<p>Plesk is kind of freaky creature. Working with it can be a frustrating experience. Not when working with the graphical web interface. Used in that way, it&#8217;s easy to create/modify/remove sub-domains and other important tasks. However, the guys from Paralles do not expect apache to server something else than static pages. How else can it be explained, that touching a vhost.conf file is something that is described in appendix A, A<em>dvanced Features</em>, in the Plesk manual?</p>
<p>So just assume that you have create a new subdomain and you want to make your CSS files available via <code>/css</code> instead of going via some hardwired domain URL. So all you want to have is an alias like</p>
<pre>
Alias /css "/path/to/my/css/folder"
</pre>
<p>Ok, but where to enter? When you look at the folder structure and files created by Plesk it is by no means clear what to do. But hey, what are manuals good for anyway? What you discover is that Plesk created a folder like</p>
<pre>
  /path/to/<strong>domain</strong>/subdomains/<strong>subdomain</strong>/conf
</pre>
<p>for your <em>subdomain</em>. The folder is empty. <strong>It would be really great if Plesk would in addition create a README file in that folder.</strong> That file would then state something like this:<br />
<i><br />
To configure your subdomain, add herein a file name vhost.conf. Put any Apache configurations in this file you like but be aware that this file is being included in a virtual host definition.</p>
<p>Once you have have added vhost.conf, please reconfigure this subdomain so that your file is taken into account. You do this by</p>
<pre>
 $ /usr/local/psa/admin/sbin/websrvmng --reconfigure-all
</pre>
<p>You need to do this only once, because this command does nothing more than insert a Include statement in /path/to/<strong>domain</strong>/conf/http.include. But refrain from do it manually because websrvmng will rewrite that file from scratch on the next run.</p>
<p>Oh, and btw notice that regardless of what our manual says you can only have a vhost.conf in a subdomain&#8217;s conf folder. Any vhost_ssl.conf therein is not taken into account.
</pre>
<p>Good luck and have a nice day.<br />
</i><br />
Unfortunately, that README file is missing.  Unfortunately.</p>
]]></content:encoded>
			<wfw:commentRss>http://workbench.haefelinger.it/archives/156/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Forward By Word!</title>
		<link>http://workbench.haefelinger.it/archives/21</link>
		<comments>http://workbench.haefelinger.it/archives/21#comments</comments>
		<pubDate>Thu, 01 Oct 2009 11:53:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[admin]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[readline]]></category>

		<guid isPermaLink="false">http://workbench.haefelinger.it/?p=21</guid>
		<description><![CDATA[I have to confess that I'm a notorious user of the command line. I do use the command line also on my MacBook Laptop where one of the first actions after having logged in is to open the so called terminal application (Terminal.app, kind of hidden in the Utilities folder). This terminal application is really a step forward compared to xterm or rxvt and is also looking marvelous good. 

The hidden gotcha is speed. Where would speed matter you may asking? Well, after having typed in and executed some command, the next command is most often just a minor variation of the previous one. Instead of retyping almost everything again, I let readline's <code>previous-history</code> function repeat the last (or an earlier) command, move the cursor <em>char-by-char</em> to the desired position where I dare to change something, do the change and eventually execute the command by pushing the <code>RETURN</code> key. ]]></description>
			<content:encoded><![CDATA[<p>I have to confess that I&#8217;m a notorious user of the command line. I do use the command line also on my MacBook Laptop where one of the first actions after having logged in is to open the so called terminal application (Terminal.app, kind of hidden in the Utilities folder). This terminal application is really a step forward compared to xterm or rxvt and is also looking marvelous good. </p>
<p>The hidden gotcha is speed. Where would speed matter you may asking? Well, after having typed in and executed some command, the next command is most often just a minor variation of the previous one. Instead of retyping almost everything again, I let readline&#8217;s <code>previous-history</code> function repeat the last (or an earlier) command, move the cursor <em>char-by-char</em> to the desired position where I dare to change something, do the change and eventually execute the command by pushing the <code>RETURN</code> key. </p>
<p>At this point I would like to add a not on the notion used in this small survey about to denote a particular key. Obviously if I mean the key &#8220;a&#8221; then it&#8217;s the small tile on your keyboard with that engraved letter &#8220;a&#8221;. &#8220;A&#8221; is bit more complicated cause it is a combination of two &#8220;tiles&#8221;, namely the &#8220;SHIFT&#8221; tile and the &#8220;a&#8221; tile. What you need to do to get the &#8220;A&#8221; is to hold down tile <code>SHIFT</code>, followed by &#8220;a&#8221; <em>without</em> releasing <code>SHIFT</code>. So how does the SHIFT key looks like on your keyboard? I have no clue. On my keyboard it&#8217;s a tile with a upword-pointing non-filled arrow character. Other keyboard keys of particular importance are the (carriage) <code>RETURN</code> key (originally to move the typewrite&#8217;s write position to the line&#8217;s beginning), the <code>CONTROL</code> key, the <code>ESCAPE</code> key and usually four navigation keys (usually right and left, up and down). </p>
<p>There must be some convention how to write down a sequence of keystrokes. The one readline uses and which is also being used in this survey is the following: <code>\C</code> means the control key and <code>\e</code> is the escape key. <code>\M</code> is the meta key. I don&#8217;t have one on my keyboard, so <code>\e</code> is taking over automatically. Furthermore there are the left and right navigation keys which I&#8217;m denoting with <code>&lt;-</code> and <code> -></code>. Notice that readline does not have a notation for this keys. Instead such a key is represented a key sequence starting with the escape key (<code>\e</code>).</p>
<p>This all works fine except that moving the cursor char-by-char is awfully slow, even in those days with a small super computer right in front of me. It would be really great if I could move forward/backward word-by-word as well. This is of course possible using readline. The function names to do so are <code>forward-word</code> and <code>backword-word</code>.</p>
<p>All fine and well except the default key bindings used for forward/backward word. The standard key binding is <code>\M-f</code> and <code>\M-b</code>. The idea is good. Use <code>\C-f </code>to move forward a char and just switch to the meta key to move forward a word instead. My problem is that I have to press key <code>\e</code> once, <em>then release that key</em> and the press the <code>f</code> key to get the desired effect. That&#8217;s much slower than pressing the <code>\C</code> key followed the <code>f</code> key while still holding the <code>\C</code> key. In fact is so much slower that I almost never used the forward move feature. But as I said, forward by char is anoyingly slow.</p>
<p>What I want to do is to assing <code>forward-word</code> with <code>\C--></code> and backward-word with <code>\C-&lt;-</code>, i.e. I would like to invoke forward-word by holding down the <code>\C</code> key followed by pressing the right arrow (and left arrow for moving backward). This would suite me quite well cause the standard action when pressing the right and left arrow is moving forward or backward a char and this are the keys I&#8217;m actually using when moving the cursor (for completness: the up and down arrow move forward and backward in the history).</p>
<p>At this point I had to dig into the documentation to be able to continue:</p>
<ol>
<li>How to configure readline?</li>
<li>How force bash to re-read the configuration?</li>
<li>How can I see the active bindings?</li>
<li>How can I see the escape characters generated by a key?</li>
</ol>
<p>The first question is easy. Add or change a (hidden) file named <code>.inputrc</code> right in your home folder. This file is taken into consideration if existing. You can change that setting an environment variable named <code>INPUTRC</code> if you are not happy with the name or the location. In any case, readline will also read the system wide configuration file <code>/etc/inputrc</code> if existing.</p>
<p>Having changed <code>.inputrc</code>, how do I make my terminal application (which runs <code>bash</code> as interactive shell) aware of any changes? You can start a new terminal application (tab or window) or you can type <code>\C-x \C-r </code> in your current one as cheap alternative.</p>
<p>Ok by now, but how can I check the current bindings? When running the <code>bash</code>, use bash&#8217;s builtin command <code>bind</code>. For example, you may want to run </p>
<pre lang="bash">
% bind -P
</pre>
<p>to get a relation between readline functions and keys bound to that function. Or you may use <code>bind -p</code> to get a <em>key : function</em> mapping for each function (the output of <code>bind -p</code> would be a valid <code>.inputrc</code> file; it also shows unbound functions &#8211; quite useful actually).</p>
<p>Jolly good by now. Except that I have no clue what kind of character sequence is generated by pressing down the right or left arrow key or even what might be generated by additionally holding down the control key (<code>\C</code>). Here another useful readline function, named <code>quoted-insert</code>, comes to rescue.  By default, this function gets invoked by <code>\C-v</code> and what it does is, that it inserts the next character you type right there at the cursor&#8217;s position. </p>
<p>So you are curious what might be generated by <code>\C</code> followed by holding down the right arrow (<code>-></code>) key? Go ahead and type <code>\C-v \C--></code> in your terminal and the result on my terminal looks like</p>
<pre lang="bash">
$ ^[[5C
</pre>
<p>Great, now we are almost there. The very last hurdle to overcome is to understand that <code>^[</code> is actually the escape key. You can verify this easily using the <code>quoted-insert</code> method explained previously. So what&#8217;s left is to add something like this to your local <code>.inputrc</code> and make <code>readline</code> reload that file:</p>
<pre lang="readline">
# Make CONTROL - (left arrow) move cursor backward
# one word resp. forward one word
"\e[5D": backward-word
"\e[5C": forward-word
</pre>
<p>Happy hacking.</p>
]]></content:encoded>
			<wfw:commentRss>http://workbench.haefelinger.it/archives/21/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mod_autoindex</title>
		<link>http://workbench.haefelinger.it/archives/13</link>
		<comments>http://workbench.haefelinger.it/archives/13#comments</comments>
		<pubDate>Sun, 13 Sep 2009 13:29:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[admin]]></category>
		<category><![CDATA[apache httpd]]></category>
		<category><![CDATA[apache_httpd]]></category>

		<guid isPermaLink="false">http://workbench.haefelinger.it/?p=13</guid>
		<description><![CDATA[Apache's webserver has got a reputation of being difficult to configure and <code>mod_autoindex</code> is actually a perfect example for this claim. I don't judge the software here as such, in my opinion, it's rather about the documentation. As a teaser, you might wonder what <code>mod_autoindex</code> generates by default? This is what get generated for a folder containg just a file and just a subfolder ..]]></description>
			<content:encoded><![CDATA[<p><code><a href="http://httpd.apache.org/docs/2.2/mod/mod_autoindex.html">mod_autoindex</a></code> is a plugin for the the <a href="http://en.wikipedia.org/wiki/Apache_web_server">Apache web server</a>. The plugin is responsible for presenting the contents of a folder if folder browsing has been enabled and if a default file, traditionally <code>index.html</code>, is not available. </p>
<p>So far so good except that the default presentation generated by <code>mod_autoindex</code> is rather boring. We want to have it a bit more spicy. Therefore <code>mod_autoindex</code> has a lot of applicable options which are crying to be used. </p>
<p>Apache&#8217;s webserver has got a reputation of being difficult to configure and <code>mod_autoindex</code> is actually a perfect example for this claim. I don&#8217;t judge the software here as such, in my opinion, it&#8217;s rather about the documentation. As a teaser, you might wonder what <code>mod_autoindex</code> generates by default? This is what get generated for a folder containg just a file and just a subfolder:</p>
<pre lang="html">
&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
&lt;html>
 &lt;head>&lt;title>Index of /js&lt;/title>&lt;/head>
 &lt;body>
&lt;h1>Index of /js&lt;/h1>
&lt;ul>&lt;li>&lt;a href="/"> Parent Directory&lt;/a>&lt;/li>
&lt;li>&lt;a href="file"> file&lt;/a>&lt;/li>
&lt;li>&lt;a href="folder"> folder&lt;/a>&lt;/li>
&lt;/ul>
&lt;/body>
&lt;/html>
</html>
</pre>
<p>Let&#8217;s go one step further and take how to apply <a href="http://httpd.apache.org/docs/2.2/mod/mod_autoindex.html#indexoptions">index options</a> as an example. Index options can be used on a <em>server config level</em> or within a <em>directory tag</em>. In other words, you may have an <em>httpd.conf</em> file looking partially like</p>
<pre lang="apache">
IndexOptions XHTML
IndexOptions HTMLTable
&lt;directory />
 IndexOptions HTMLTable
&lt;/directory>
</pre>
<p>The overall question is: <em>what do we get by this?</em>. Obviously we try to enable XHTML and we try to enable the generation of a table instead of the unordered list (<code>&lt;ul></code>). But that&#8217;s not what we get. What we get is the html table rendered in plain HTML 3.2. How does this come?</p>
<p>It appears, and the documentation really needs to be more explicit on this, that index options are handled quite differently if they are encountered within a directory tag (<code>&lt;directory /></code>) or on the top level. When processing the configuration, Apache first calculates the value on the server config level. This is simply done by accumulating all index options into a list. For example, if there is <code>IndexOptions X</code> and somewhere later a <code>IndexOptions Y</code>, then we end up in a list like <code>{X, Y}.</code>. This is probably what you expect.</p>
<p>The server config value calculated is then applied to the root directory (<code>/</code>). If no directory tags are present, this is then the value applied.</p>
<p>If a directory tag for path <code>/foo/bar</code> is present, the value is calculated in two steps. In step one, the value is inherited from directory <code>/foo</code> which in turn will get its value from <code>/</code>.  In step two, index options found within the directory tag are applied <em>in an incremental fashion</em>.</p>
<p>Incremental index options are applied like this: if the options starts with a plus sign, the option&#8217;s value gets added to the list value. If it starts with a dash, the option&#8217;s value will be removed from the list. If neither plus not dash, the current list value is erased and the new list value will be the value of index option under investigation.</p>
<p>So, let&#8217;s have again a look at our configuration:</p>
<pre lang="apache">
IndexOptions XHTML
IndexOptions HTMLTable
&lt;directory />
 IndexOptions HTMLTable
&lt;/directory>
</pre>
<p>The calculated index option valaue after having processed the server config level before digging into the directory tag is {XHTML, HTMLTable}. Then directory <code>/</code> is processed by inheriting {XHTML, HTMLTable} followed by applying incremental rules. Therefore the final value is cleared and replaced by {HTMLTable}.</p>
<p>Notice on the other hand that incremental options on top level do not work at all:</p>
<pre lang="apache">
IndexOptions +XHTML
IndexOptions +HTMLTable
</pre>
<p>This has just no effect. Incremental options on top level are silently ignored.</p>
<p>In summary it&#8217;s mainly Apache&#8217;s documentation doing a bad job here:</p>
<ul>
<li>The documentation does not state what we have to expect if no options are applied</li>
<li>It is not clear at all how options are processed. Lots of other weired behaviours could have been implemented.</li>
<li>It is rather bad to use the same identifier (IndexOptions) for a different behaviour. If so this should be clearly documented</li>
</ul>
<p>I like to dwell in a bit on the last point. From a legacy point of view, older version of Apache supported non-incremental index options. Starting with Apache 1.3, incremental index options were added. So suddenly we can have index options that start with a plus character, or a dash or with extra character. Then someone decided that the absence of a character means <em>erase</em>. That conflicts of course with the legacy meaning where the absence of a character means actually <code>+</code>. </p>
<p>It would have been much better to define the <em>absence</em> of a character as <em>use the default</em> character and to use a third character for replacing. Such a character could have been <code>=</code>. Then we would end up in those rules, regardless whether on a server config level or within a directory:</p>
<ul>
<li>If an index options starts with <code>+</code> then it&#8217;s value is added.</li>
<li>If an index options starts with <code>-</code> then it&#8217;s value is removed.</li>
<li>If an index options starts with <code>=</code> then it&#8217;s value replaces the calculated value so far</li>
<li>Otherwise: treat the option as if the value starts with <code>+</code>.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://workbench.haefelinger.it/archives/13/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mediawiki on MacPorts</title>
		<link>http://workbench.haefelinger.it/archives/1</link>
		<comments>http://workbench.haefelinger.it/archives/1#comments</comments>
		<pubDate>Wed, 02 Sep 2009 19:11:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[admin]]></category>
		<category><![CDATA[macports]]></category>
		<category><![CDATA[macosx]]></category>
		<category><![CDATA[mediawiki]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://workbench.haefelinger.it/?p=1</guid>
		<description><![CDATA[The installation of <a href="http://en.wikipedia.org/wiki/Mediawiki">Mediawiki</a> is not without pain, especially when using <a href="http://en.wikipedia.org/wiki/Macports">MacPorts</a> on <a href="http://en.wikipedia.org/wiki/Macos_x">MacOS X</a>. A repeating problem is the location of <a href="http://en.wikipedia.org/wiki/Mysql">MySQL</a>'s socket file. For unkown or rather questionable reasons, MacPorts moved that file from it's default location in folder <code>/tmp</code> to <code>/opt/local/var/run/mysql5/mysqld.sock </code> 
[..]]]></description>
			<content:encoded><![CDATA[<p>The installation of <a href="http://en.wikipedia.org/wiki/Mediawiki">Mediawiki</a> is not without pain, especially when using <a href="http://en.wikipedia.org/wiki/Macports">MacPorts</a> on <a href="http://en.wikipedia.org/wiki/Macos_x">MacOS X</a>. A repeating problem is the location of <a href="http://en.wikipedia.org/wiki/Mysql">MySQL</a>&#8217;s socket file. For unkown or rather questionable reasons, MacPorts moved that file from it&#8217;s default location in folder <code>/tmp</code> to </p>
<pre>
/opt/local/var/run/mysql5/mysqld.sock
</pre>
<p>Even  worse, the file&#8217;s name, usually <code>mysql.sock</code>, has now changed into <code>mysqld.sock</code>. So it comes to no surprise that applications like PHP, Mediawiki and oh-you-name-it simply choke. Except if you also install those via MacPorts. Then you may have a chance that it works. </p>
<p>Personnally however I don&#8217;t like this <em>all-or-nothing</em> approach. Ideally I would like to have a system where MacPorts lives in a friendly coexistence with tools not provided by MacPorts.  Wouldn&#8217;t it be good if there were a kind of <em>registry</em> knowing about locations? Unfortunatly, such a registry beast is still missing on UNIX based platforms. As much as I like the UNIX approach, all those config file locations and dialects drives me crazy. </p>
<p>So how would Mediawiki know that my MySQL&#8217;s configuration file is burried deep in <code>/opt/local/etc</code> and that furthermore, MySQL got pached to use that fancy location mentioned above? </p>
<p>Well, it simply can&#8217;t figure it out.</p>
<p>Now, you may think that&#8217;s no problem then. We just tell Mediawiki where it is. That&#8217;s not going to work either as long as you are unwilling to wrestle with Mediawikis PHP code: joy-oh-joy, it&#8217;s just hardwired to <code>/tmp/mysql.sock</code>. Period. So, what you need to do is to ask good old <code><a href="http://en.wikipedia.org/wiki/Ln_%28Unix%29">ln</a> -s</code> for rescue:</p>
<pre>
% sudo ln -s /opt/local/var/run/mysql5/mysqld.sock /tmp/mysql.sock
</pre>
<p>This works eventually but it&#8217;s really ugly cause the problem with links is that after a while no one knows why this link was created in the first place.</p>
<p>Happy Hacking.</p>
]]></content:encoded>
			<wfw:commentRss>http://workbench.haefelinger.it/archives/1/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
