<?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>randys.org &#187; mysql</title>
	<atom:link href="http://www.randys.org/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.randys.org</link>
	<description>wasting your precious bandwidth since 1998</description>
	<lastBuildDate>Mon, 17 May 2010 15:12:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>LiMP: Lighttpd, MySQL &amp; PHP on OS X</title>
		<link>http://www.randys.org/2006/10/03/limp-lighttpd-mysql-php-on-os-x/</link>
		<comments>http://www.randys.org/2006/10/03/limp-lighttpd-mysql-php-on-os-x/#comments</comments>
		<pubDate>Tue, 03 Oct 2006 07:19:00 +0000</pubDate>
		<dc:creator>randy</dc:creator>
				<category><![CDATA[Code Chunks]]></category>
		<category><![CDATA[General Nerdery]]></category>
		<category><![CDATA[Home]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[os]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[x]]></category>

		<guid isPermaLink="false">http://www.randys.org//2006/10/03/limp-lighttpd-mysql-php-on-os-x</guid>
		<description><![CDATA[In following with the LAMP, MAMP, and WAMP themes, I&#8217;ve come up with my own acronym: LiMP. Lighttpd, MySQL, PHP. Of course, this doesn&#8217;t really follow the conventions of the other acronyms (my OS isn&#8217;t represented). Mainly because adding an &#8216;M&#8217; just doesn&#8217;t sound (or look) right. It&#8217;s a great setup and I recently reconfigured [...]]]></description>
			<content:encoded><![CDATA[<p>In following with the LAMP, MAMP, and WAMP themes, I&#8217;ve come up with my own acronym: LiMP. <a href="http://lighttpd.net">Lighttpd</a>, <a href="http://www.mysql.com">MySQL</a>, <a href="http://www.php.net">PHP</a>. Of course, this doesn&#8217;t <em>really</em> follow the conventions of the other acronyms (my OS isn&#8217;t represented). Mainly because adding an &#8216;M&#8217; just doesn&#8217;t sound (or look) right. It&#8217;s a great setup and I recently reconfigured it so it&#8217;s a (somewhat) isolated installation that could potentially be installed on any OS X system. I also managed to get ExecWrap working properly as well.</p>

<p><em>*NB</em>*
This is a fairly technical article and requires getting your fingers dirty in the Terminal (a.k.a. comman line). If you&#8217;re not fully comfortable in the Terminal, I suggest you familiarize yourself with the Terminal. You&#8217;ll also need to have installed the latest version of <a href="http://developer.apple.com/tools/index.html">Xcode</a>.</p>

<p>You can build this just about anywhere on your system you like. I personally keep everything in <pre><code>/usr/local/src</code></pre> but you can build this anywhere you want on your system. I also like to <pre><code>sudo -s</code></pre> so that I&#8217;m always root when comiling and installing these things. Let&#8217;s jump in&#8230;</p>

<p>Create your src directories:</p>

<p><pre><code>mkdir -p /usr/local/src &amp;&amp; cd /usr/local/src
</code></pre></p>

<p>That&#8217;s it. Now lets dig in&#8230;</p>

<h2>Setting up Lighttpd on OS X</h2>

<p>I figured building this on OS X wouldn&#8217;t take too much effort and I was pretty much right. Lighttpd builds just fine on OS X but it does need some other libraries installed for certain functionality. Specifically, <a href="http://www.fastcgi.com/">fastcgi</a> and <a href="http://www.pcre.org/" title="PCRE">Perl Compatible Regular Expressions</a>. These libraries install without issue as well.</p>

<p>First lets grab the fastcgi libraries:</p>

<p><pre><code>curl -O http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz
tar zxvf fcgi-2.4.0.tar.gz &amp;&amp; cd fcgi-2.4.0
./configure
make
make install
cd ..
</code></pre></p>

<p>Now lets get the PCRE libraries:</p>

<p><pre><code>curl -O ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-5.0.tar.gz
tar zxvf pcre-5.0.tar.gz &amp;&amp; cd pcre-5.0
./configure
make
make install
cd ..
</code></pre></p>

<p>Now for lighttpd:</p>

<p><pre><code>curl -O http://www.lighttpd.net/download/lighttpd-1.4.12.tar.gz
tar zxvf lighttpd-1.4.12.tar.gz &amp;&amp; cd lighttpd-1.4.12
./configure --prefix=/Library/limp/lighttpd
</code></pre></p>

<p>Hopefully, you&#8217;ll see something like this after the configure script is done.</p>

<p><pre><code>Plugins:</p>

<p>mod_rewrite     : enabled
mod_redirect    : enabled
mod_ssi         : enabled
mod_cgi         : enabled
mod_fastcgi     : enabled
mod_proxy       : enabled
mod_evhost      : enabled
mod_simple_vhost: enabled
mod_mysql_vhost : enabled
mod_access      : enabled
mod_alias       : enabled
mod_setenv      : enabled
mod_usertrack   : enabled
mod_compress    : enabled
mod_auth        : enabled
mod_status      : enabled
mod_accesslog   : enabled
mod_rrdtool     : enabled
mod_secdownload : enabled
mod_expire      : enabled
</code></pre></p>

<p>If you don&#8217;t see mod_fastcgi in there, something went south.</p>

<p><pre><code>make
make install
cp doc/lighttpd.conf /Library/limp/lighttpd/lighttpd.conf
</code></pre></p>

<h2>MySQL</h2>

<p>For MySQL, I just used the standard binary installation provided by <a href=") themselves. Unfortunately, the doesn't install the correct libraries for compiling the mysqli extension of PHP (which is needed for MySQL 4.1 and newer">MySQL</a>. Therefore, we&#8217;ll need to also configure and install the libraries after installing the binary package. (Thanks to <a href="http://switch.richard5.net/isp-in-a-box-v2/installing-mysql-on-mac-os-x/">Richard Valk</a> for his article series for this bit).</p>

<p>First, download and install MySQL (version 5.0.24a as of this writing) Standard binary for OS X for your platform (PPC or Intel). Once you&#8217;ve installed the package, install the StartupItem and make your life simple-er (??). After everything is setup, you should modify your <pre><code>PATH</code></pre> environment variable again in your ~/.bashrc file.</p>

<p><pre><code>export PATH="/usr/local/bin:/usr/local/mysql/bin:"${PATH}
</code></pre></p>

<p>Now we have to rebuild mysql and install the shared libraries we need for building PHP. Make sure you&#8217;re still in your &#8216;src&#8217; directory.</p>

<p><pre><code>curl -O http://www.stathy.com/mysql/Downloads/MySQL-5.0/mysql-5.0.24.tar.gz
tar zxvf mysql-5.0.24.tar.gz &amp;&amp; cd mysql-5.0.24
./configure --prefix=/usr/local/mysql \
 --localstatedir=/usr/local/mysql/data \
 --libexecdir=/usr/local/mysql/bin \
 --libdir=/usr/local/mysql/lib \
 --with-server-suffix=-standard \
 --enable-thread-safe-client \
 --enable-local-infile \
 --enable-shared \
 --with-zlib-dir=bundled \
 --with-big-tables \
 --with-readline \
 --with-archive-storage-engine \
 --with-innodb \
 --without-docs \
 --without-bench \
make
make install
cd ..
</code></pre></p>

<h2>Compiling PHP on OS X (with the mysqli extension)</h2>

<p>This was fairly straight forward with the exception of GD. It took me a while to figure this out, but I was using <pre><code>--with-gd=/sw</code></pre> and this was confusing the compiler for some reason. When I changed it to just <pre><code>--with-gd</code></pre> everything compiled fine&#8230; including the mysqli extension. Here&#8217;s what my config looks like:</p>

<p><pre><code>./configure \
 --prefix=/Lbrary/limp/php \
 --enable-fastcgi \
 --enable-force-cgi-redirect \
 --enable-mbstring \
 --with-xml \
 --with-zlib \
 --with-curl \
 --with-mysql=/usr/local/mysql \
 --with-pdo-mysql=/usr/local/mysql \
 --with-mysqli=/usr/local/mysql/bin/mysql_config \
 --with-pdo-sqlite \
 --with-sqlite \
 --with-mcrypt=/sw \
 --with-gd \
 --with-jpeg-dir=/sw \
 --with-png-dir=/sw \
 --with-zlib-dir=/sw \
 --with-xpm-dir=/usr \
 --enable-exif \
 --enable-ftp \
 --enable-libxml \
 --enable-soap \
 --enable-sockets</p>

<p>make &amp;&amp; make install
cp /Library/limp/php/bin/php /Library/limp/php/bin/php-cgi
</code></pre></p>

<p>I&#8217;m renaming the php binary to php-cgi because, well, that&#8217;s what it is. It&#8217;s the CGI version, not the CLI version. If you want to compile the CLI version, replace</p>

<p><pre><code> --enable-fastcgi \
 --enable-force-cgi-redirect \
</code></pre></p>

<p>with</p>

<p><pre><code> --enable-cli \
</code></pre></p>

<p>and run <pre><code>make &amp;&amp; make install</code></pre> again. Only do this <strong>after</strong> you&#8217;ve renamed the php file to php-cgi. Otherwise, you&#8217;ll overwrite the cgi version with the cli version and it won&#8217;t work with fastcgi.</p>

<h2>Building ExecWrap</h2>

<hr/>

<p>I&#8217;ll have to finish this at a later date&#8230; sorry. This was originally posted to my old WordPress blog as a <em>Draft</em> but got imported into Typo via the wordpress2.rb script as a published article&#8230; so I left it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.randys.org/2006/10/03/limp-lighttpd-mysql-php-on-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
