<?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>Stuntbox &#187; sql</title>
	<atom:link href="http://stuntbox.com/blog/tag/sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://stuntbox.com</link>
	<description>David Sleight&#039;s Blog</description>
	<lastBuildDate>Tue, 06 Jul 2010 15:04:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Better Than the SQL</title>
		<link>http://stuntbox.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fstuntbox.com%2Fblog%2F2007%2F01%2Fbetter-than-the-sql%2F&amp;seed_title=Better+Than+the+SQL</link>
		<comments>http://stuntbox.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fstuntbox.com%2Fblog%2F2007%2F01%2Fbetter-than-the-sql%2F&amp;seed_title=Better+Than+the+SQL#comments</comments>
		<pubDate>Fri, 05 Jan 2007 05:35:28 +0000</pubDate>
		<dc:creator>David Sleight</dc:creator>
				<category><![CDATA[Post]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.stuntbox.com/blog/2007/01/better-than-the-sql/</guid>
		<description><![CDATA[Change WordPress IPs, fast.]]></description>
			<content:encoded><![CDATA[<p><img src="/images/posts/no_parking.jpg" alt="" width="500" height="300" /></p>
<p>If you&#8217;ve set up WordPress in a localhost testing environment you may already be familiar with the vagaries of <var>site_url</var> and <var>home</var>.</p>
<p>Basically, these values correspond to the &#8220;WordPress address&#8221; and &#8220;Blog address&#8221; fields under the <cite>Options</cite> section of the WP admin interface. For a localhost install you&#8217;d, quite naturally, want to pick something based off of <code>localhost</code>. This won&#8217;t be too useful though if you plan to view your WordPress site from other machines. (That includes virtual machines on the same computer—like, say, testing Internet Explorer from Parallels on your MacBook.) WordPress will hand out URLs literally containing <code>localhost</code>, prompting your remote machine to immediately turn around and begin contemplating its own navel. No good. </p>
<p>Okay then, so what about using an IP address instead?</p>
<p>Therein lies the rub. What if your machine moves from network to network (like said MacBook) or is on DHCP? That&#8217;s a rhetorical question of course, since I wouldn&#8217;t be writing this if I hadn&#8217;t already gone ahead and done this (precocious lad that I am). If you hard-code an IP as the value of <var>site_url</var> or <var>home</var>, and the IP of the host changes, large swathes of your WordPress site (including the ever-important admin) will become inaccessible. </p>
<p>It really comes down to what&#8217;s more valuable to you. If you simply need a self-contained development environment, stick with <code>localhost</code>. If you&#8217;re like me though, and need a platform to test against, the IP address is really the only way to go that I know of. So what&#8217;s really needed to make this latter case workable is a quick way to update <var>site_url</var> and <var>home</var>. And no, you can&#8217;t just go into the WP admin and change them. (The admin will be out of commission by the time you find out what your new IP is, remember?)</p>
<p>There are instructions out there for doing this kind of update <a href="http://tamba2.org.uk/wordpress/site-url/" title="WordPress @ T2: Change site_url and home values">via phpMyAdmin</a>, but I prefer going straight to MySQL. To see what the current values are use the following SQL statements (where <var>blog</var> is the name of your own WordPress database):</p>
<blockquote><p><code>SELECT * FROM blog.wp_options WHERE option_name = 'siteurl';</code></p>
<p><code>SELECT * FROM blog.wp_options WHERE option_name = 'home';</code></p>
</blockquote>
<p>The current addresses will be under the <var>option_value</var> column. To edit these use the following, again replacing <var>blog</var> with the name of your WordPress database and inserting your own IP/blog path where appropriate (without trailing slashes):</p>
<blockquote><p><code>UPDATE blog.wp_options SET option_value = "http://xxx.xxx.xxx.xxx/blog" WHERE option_name = 'siteurl';</code></p>
<p><code>UPDATE blog.wp_options SET option_value = "http://xxx.xxx.xxx.xxx/blog" WHERE option_name = 'home';</code></p>
</blockquote>
<p>And there you have it. A fast update that lets you maintain a portable WordPress testing environment. </p>
]]></content:encoded>
			<wfw:commentRss>http://stuntbox.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fstuntbox.com%2Fblog%2F2007%2F01%2Fbetter-than-the-sql%2F&amp;seed_title=Better+Than+the+SQL/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Who Moved My Socket?</title>
		<link>http://stuntbox.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fstuntbox.com%2Fblog%2F2007%2F01%2Fwho-moved-my-socket%2F&amp;seed_title=Who+Moved+My+Socket%3F</link>
		<comments>http://stuntbox.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fstuntbox.com%2Fblog%2F2007%2F01%2Fwho-moved-my-socket%2F&amp;seed_title=Who+Moved+My+Socket%3F#comments</comments>
		<pubDate>Wed, 03 Jan 2007 06:58:49 +0000</pubDate>
		<dc:creator>David Sleight</dc:creator>
				<category><![CDATA[Post]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.stuntbox.com/blog/2007/01/who-moved-my-socket/</guid>
		<description><![CDATA[Playing hide-and-seek with your database.]]></description>
			<content:encoded><![CDATA[<p><img src="/images/posts/light_trails_01.jpg" alt="" width="500" height="200" /></p>
<p>While gearing up to get the latest version of Stuntbox out the door I set up a new localhost testing environment on my MacBook. That included fresh installs of MySQL and WordPress (using the already-baked-into-OS-X versions of Apache and PHP). Nothing unusual there. </p>
<p>Apparently it had been a little while since I had actively used the combination though, because somebody went and made some changes while I had my back turned. </p>
<h2>Cue Breaking Glass</h2>
<p>If you&#8217;ve ever set up PHP/MySQL on OS X you know it&#8217;s no big deal. Uncomment a couple of lines in Apache&#8217;s <code>http.conf</code> file, then download a fresh MySQL install and follow the <a href="http://dev.mysql.com/doc/refman/5.0/en/mac-os-x-installation.html" title="MySQL Reference Manual: Installing MySQL on Mac OS X">relatively straightforward instructions</a>. (You always remember to <a href="http://dev.mysql.com/doc/refman/5.0/en/default-privileges.html" title="MySQL Reference Manual: Securing the Initial MySQL Accounts">secure your initial user accounts</a>, right?) If you&#8217;re used to this sort of dance the whole thing will take you all of a half hour, if that. So I wasn&#8217;t paying too much attention post-install when I started throwing other applications into the mix. Phooey on me for not testing the PHP/MySQL connection first though because WordPress immediately coughed up the following hairball:</p>
<blockquote><p><samp>Error establishing a database connection. This either means that the username and password information in your wp-config.php file is incorrect or we can&#8217;t contact the database server at localhost. This could mean your host&#8217;s database server is down.</samp></p>
</blockquote>
<p>Well my <code>wp-config.php</code> was fine, and MySQL was very much up and running, so that left the database connection. After some trial and error with Google I came across a tech note on Apple&#8217;s support site called <cite><a href="http://docs.info.apple.com/article.html?artnum=302977">Mac OS X Server 10.4.4: Improvements to Apache/PHP/MySQL</a></cite>. Turns out that, as of OS X 10.4.4, the default socket location for PHP and MySQL has been moved. Fortunately an easy fix is detailed under the second section of the note. Basically it comes down to editing the socket location in your <code>php.ini</code> file (or creating one if it doesn&#8217;t exist yet). </p>
<p>I find it more than a little odd that I had to dig up a note about the <em>server</em> version of the OS to uncover an explanation from Apple about this. That&#8217;s important because, while there are <a href="http://www.macosxhints.com/article.php?story=20060111113313511&#038;lsrc=osxh" title="macosxhints.com: Repair PHP/MySQL connections in 10.4.4">other fixes</a> out there, this is the only that has any hope of explaining <em>why</em> the change was made. </p>
<h2>Snow Leopard Update</h2>
<p> Since this post was originally written, OS X 10.6 “Snow Leopard” has been released. <a href=”http://maestric.com/doc/mac/apache_php_mysql_snow_leopard”>A modified version of the above instructions now applies</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://stuntbox.com/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fstuntbox.com%2Fblog%2F2007%2F01%2Fwho-moved-my-socket%2F&amp;seed_title=Who+Moved+My+Socket%3F/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
