<?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>Derek Punsalan - 5THIRTYONE &#187; database</title> <atom:link href="http://5thirtyone.com/archives/tag/database/feed" rel="self" type="application/rss+xml" /><link>http://5thirtyone.com</link> <description>A personal site by Derek Punsalan sharing personal interests with technology, WordPress, design, and general geekery.</description> <lastBuildDate>Wed, 10 Mar 2010 06:09:35 +0000</lastBuildDate> <generator>http://wordpress.org/?v=2.9.2</generator> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/> <item><title>Sample WordPress content for development</title><link>http://5thirtyone.com/archives/1921</link> <comments>http://5thirtyone.com/archives/1921#comments</comments> <pubDate>Fri, 30 Jan 2009 18:11:28 +0000</pubDate> <dc:creator>Derek</dc:creator> <category><![CDATA[Breadcrumbs]]></category> <category><![CDATA[database]]></category> <category><![CDATA[test]]></category> <category><![CDATA[WordPress]]></category><guid
isPermaLink="false">http://5thirtyone.com/?p=1921</guid> <description><![CDATA[Saving the lazy developer / designer in each of us. WPCandy created a downloadable WordPress DB that populates your test server with 12 posts of dummy. Import is done through the built-in Importer tool.
Readers Also ReadImprove WordPress typographyWordPress 2.3+ official support for custom database error page&#8220;The future of WordPress themes&#8221;, what do you think?]]></description> <content:encoded><![CDATA[<p>Saving the lazy developer / designer in each of us. WPCandy created a downloadable WordPress DB that populates your test server with 12 posts of dummy. Import is done through the built-in Importer tool.</p><div
id="wherego_related"><h3>Readers Also Read</h3><ul><li><a
href="http://5thirtyone.com/archives/2115" rel="bookmark" class="wherego_title">Improve WordPress typography</a></li><li><a
href="http://5thirtyone.com/archives/879" rel="bookmark" class="wherego_title">WordPress 2.3+ official support for custom database error page</a></li><li><a
href="http://5thirtyone.com/archives/2018" rel="bookmark" class="wherego_title">&#8220;The future of WordPress themes&#8221;, what do you think?</a></li></ul></div>]]></content:encoded> <wfw:commentRss>http://5thirtyone.com/archives/1921/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>WordPress 2.3+ official support for custom database error page</title><link>http://5thirtyone.com/archives/879</link> <comments>http://5thirtyone.com/archives/879#comments</comments> <pubDate>Tue, 12 Feb 2008 06:07:09 +0000</pubDate> <dc:creator>Derek</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[custom]]></category> <category><![CDATA[database]]></category> <category><![CDATA[db-error.php]]></category> <category><![CDATA[error]]></category><guid
isPermaLink="false">http://5thirtyone.com/archives/879</guid> <description><![CDATA[Some time ago a tutorial was posted on 5ThirtyOne which addressed customizing the DB Error page rendered whenever visitors landed on heavily trafficked WordPress site. Since then, the method has been proven &#34;useless&#34;, ushered away by recent updates to the WordPress code base; more specifically with the release of WordPress 2.3.2 (current release is 2.3.3). [...]]]></description> <content:encoded><![CDATA[<p>Some time ago a tutorial was posted on <a
href="http://5thirtyone.com/">5ThirtyOne</a> which addressed <a
href="http://5thirtyone.com/archives/408">customizing the DB Error page</a> rendered whenever visitors landed on heavily trafficked <a
href="http://wordpress.org">WordPress</a> site. Since then, the method has been proven &quot;useless&quot;, ushered away by recent updates to the WordPress code base; more specifically with the <a
href="http://wordpress.org/development/2007/12/wordpress-232/">release of WordPress 2.3.2</a> (<a
href="http://wordpress.org/download/">current release</a> is 2.3.3). Whereas the previous method required manipulating code within a core WordPress file, the new updated method allows for the custom page to be stored externally of the WP root directory. To get started creating your own custom WordPress database error page, follow the two steps below:</p><h3>Create a db-error.php file in /wp-content/</h3><p>First things first. Create an XHTML file called <code>db-error.php</code> and upload it to the WordPress <code>/wp-content/</code> directory.</p><p
align="center"><img
src="http://5thirtyone.com/wp-content/uploads/2008/10/dberrorfile.png" alt="DB Error file in Transmit" /></p><p>Because visitors will see this page when your WordPress driven website is experiencing database connection errors, you will need to make sure the file includes any style attributes inline, or reference an external stylesheet (absolute URL).</p><div
class="wp_syntax"><div
class="code"><pre class="html" style="font-family:monospace;">&lt;style type=&quot;text/css&quot;&gt;...your CSS goes here...&lt;/style&gt;</pre></div></div><p
align="center">or</p><div
class="wp_syntax"><div
class="code"><pre class="html" style="font-family:monospace;">&lt;link href=&quot;http://url.com/my-stylesheet.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;</pre></div></div><p>For the sake of simplicity, we&#8217;ll create a custom database error page with a single XHTML document including any style attributes inside the <code>&lt;head&gt;</code> tags. The following is the message skeleton originally created and used in the tutorial <a
href="http://5thirtyone.com/archives/408">here</a>.</p><div
class="wp_syntax"><div
class="code"><pre class="html" style="font-family:monospace;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head profile=&quot;http://gmpg.org/xfn/11&quot;&gt;
&lt;title&gt;My server crashed, please call the next of kin&lt;/title&gt;
&lt;style type=&quot;text/css&quot;&gt;
body {
font-family: arial, verdana, sans-serif;
font-size: 62.5%;
background: #fff;
color: #333;
text-align: center;
}
a {
text-decoration: none;
outline: none;
}
#error_wrapper {
font-size: 1.3em;
margin: 5em auto 0;
text-align: left;
width: 333px;
}
.content_wrapper {
padding: 1em 0.7em 0;
}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;error_wrapper&quot;&gt;
&lt;div class=&quot;content_wrapper&quot;&gt;
&lt;p&gt;It looks as though my server has taken an unsupervised leave of absence. I may not know of its whereabouts so would you be so kind as to notify me via &lt;a href=&quot;mailto:admin@domain.com&quot; title=&quot;Send me an email&quot;&gt;email&lt;/a&gt;?&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></div></div><h3>Second step, there is none</h3><p>If you created a standard XHTML document and dropped the code in <code>db-error.php</code> inside the <code>/wp-content</code> directory, there really isn&#8217;t anything else to do other than to ensure that your site visitors never see a WordPress database error page while visiting your site.</p><div
id="wherego_related"><h3>Readers Also Read</h3><ul><li><a
href="http://5thirtyone.com/archives/1921" rel="bookmark" class="wherego_title">Sample WordPress content for development</a></li><li><a
href="http://5thirtyone.com/archives/408" rel="bookmark" class="wherego_title">Custom WordPress Database Error</a></li></ul></div>]]></content:encoded> <wfw:commentRss>http://5thirtyone.com/archives/879/feed</wfw:commentRss> <slash:comments>6</slash:comments> </item> <item><title>Migrate: Media Temple Grid Server to Dedicated Virtual</title><link>http://5thirtyone.com/archives/757</link> <comments>http://5thirtyone.com/archives/757#comments</comments> <pubDate>Sun, 04 Feb 2007 15:00:46 +0000</pubDate> <dc:creator>Derek</dc:creator> <category><![CDATA[Tutorial]]></category> <category><![CDATA[database]]></category> <category><![CDATA[hosting]]></category> <category><![CDATA[mediatemple]]></category> <category><![CDATA[migrate]]></category> <category><![CDATA[mysql]]></category> <category><![CDATA[ssh]]></category><guid
isPermaLink="false">http://5thirtyone.com/archives/757</guid> <description><![CDATA[The migration from Media Temple&#8217;s Grid Server to the Dedicated Virtual web hosting solution was surprisingly easy. With initial pointers from Paul, I was well on my way to successfully migrating four hosted sites from the &#34;Grid&#34; to the DV. Media Temple&#8217;s Dedicated Virtual hosting plans provide a considerable amount of flexibility &#8211; including root [...]]]></description> <content:encoded><![CDATA[<p>The migration from Media Temple&#8217;s <a
href="http://www.mediatemple.net/webhosting/gs/" title="(mt) Grid Server">Grid Server</a> to the <a
href="http://www.mediatemple.net/webhosting/dv/" title="(mt) Dedicated Virtual">Dedicated Virtual</a> web hosting solution was surprisingly <em>easy</em>. With initial pointers from <a
href="http://pstam.com" title="Paul Stamatiou">Paul</a>, I was well on my way to successfully migrating four hosted sites from the &quot;Grid&quot; to the DV. Media Temple&#8217;s Dedicated Virtual hosting plans provide a considerable amount of flexibility &#8211; including root access &#8211; which is ideal for users who want complete control of their own or client(s) websites.</p><p>Unfortunately, the <a
href="http://kb.mediatemple.net/" title="Visit the Media Temple Knowledge Base">(mt) Knowledge Base</a> is a little thin and may not be of much help for those that may feel disoriented or overwhelmed by the task of moving from the Grid Server to a Dedicated Virtual. I know <em>I was</em>. Fortunately, with a little trial and error, reading, and a successful migration, the following was documented in hopes of helping others who plan on making the move. Much praise for <a
href="http://www.swsoft.com/plesk/" title="Control Panel Software for Hosting">Plesk</a> &#8211; the control panel software of choice provided for Media Temple customers.</p><p>For the following example, we&#8217;ll move an entire <a
href="http://wordpress.org">WordPress</a> driven site from the Grid to the DV. We&#8217;ll take this opportunity to install a <em>fresh</em> new install of WordPress. The beauty of moving to a completely different server is that a) you have an opportunity to start afresh, and b) you can tweak and prepare your site before DNS changes are made (any and all improvements that you&#8217;ve pushed back due to procrastination or sheer laziness can finally be completed).</p><p><em>The general intent of this tutorial is to serve as a reference for any website owners anticipating a move from a current hosting solution to a second, third, or fourth.</em></p><h3>Check-list: What do I need to do?</h3><ul><li>Export your WordPress database using phpMyAdmin [<a
href="http://5thirtyone.com/archives/757#7571" title="Jump to this segment of the tutorial">#</a>]</li><li>Download important files and directories &#8211; <em>.htaccess, wp-config.php, /wp-content/uploads, /wp-content/plugins,</em> and <em>/wp-content/themes</em> [<a
href="http://5thirtyone.com/archives/757#7572" title="Jump to this segment of the tutorial">#</a>]</li><li>Upload a new WordPress installation into your new server <span
id="more-757"></span><em>httpdocs</em> directory [<a
href="http://5thirtyone.com/archives/757#7573" title="Jump to this segment of the tutorial">#</a>]</li><li>Create database to match <em>wp-config.php</em> settings or start new [<a
href="http://5thirtyone.com/archives/757#7574" title="Jump to this segment of the tutorial">#</a>]</li><li>Upload important files and directories &#8211; <em>.htaccess, wp-config.php, /wp-content/uploads, /wp-content/plugins,</em> and <em>/wp-content/themes</em> [<a
href="http://5thirtyone.com/archives/757#7575" title="Jump to this segment of the tutorial">#</a>]</li><li>Import old WordPress database via <em>SSH</em> [<a
href="http://5thirtyone.com/archives/757#7576" title="Jump to this segment of the tutorial">#</a>]</li><li>Double-check website before requesting DNS change [<a
href="http://5thirtyone.com/archives/757#7577" title="Jump to this segment of the tutorial">#</a>]</li><li>If everything checks out as it should, decide what hours generate the least amount of traffic and request DNS change to match [<a
href="http://5thirtyone.com/archives/757#7578" title="Jump to this segment of the tutorial">#</a>]</li></ul><h3 id="7571">Export your WordPress database</h3><p
align="center"><img
src="http://5thirtyone.com/wp-content/uploads/2007/02/mysqladmin.png" alt="MySQL Admin - Media Temple WebControl" /></p><p>In order to successfully move your WordPress posts, comments, and configuration settings, you&#8217;ll need to export your existing database (SQL). This can be done using the phpMyAdmin interface accessed via the Grid Server Account Server <em>WebControl > MySQL Admin</em>.</p><p
align="center"><img
src="http://5thirtyone.com/wp-content/uploads/2007/02/phpmyadmin_export.png" alt="phpMyAdmin - Export tab" /></p><p>Once inside phpMyAdmin, locate the Database drop down menu and select the associated WordPress database for export. In the following view, find the &#8216;Export&#8217; tab.</p><p
align="center"><img
src="http://5thirtyone.com/wp-content/uploads/2007/02/exportinterface.png" alt="phpMyAdmin - Export web interface" /></p><p>Within the &#8216;View dump (schema) of database&#8217; view, ensure that the following parameters match:</p><ul><li><strong>Export</strong> &#8211; If this database is used for nothing other than your WordPress installation, click the &#8216;Select All&#8217; option which will highlight all WordPress related tables preceded with &#8220;wp_&#8221;. Ensure that the SQL radio button is ticked.</li><li><strong>SQL Options > Structure</strong> &#8211; Ensure that the following and nothing else are selected: &#8216;Structure&#8217;, &#8216;Add DROP TABLE&#8217;, &#8216;Add AUTO_INCREMENT value&#8217;, and &#8216;Enclose table and field names with backquotes&#8217;.</li><li><strong>SQL Options > Date</strong> &#8211; Ensure that the &#8216;Data&#8217; box is checked. Also check &#8216;Complete Inserts&#8217; and &#8216;Use hexidecimal for binary fields&#8217;.</li><li>Scroll down and check the &#8216;Save as file&#8217; box. Leave the default file name template and compression settings and click the &#8216;Go&#8217; button. phpMyAdmin will then prompt you to save a backup of your database. Do so and move to SQL file to a safe directory on your computer.</li></ul><p>You have successfully backed-up your entire WordPress &#8220;core&#8221; &#8211; settings, configurations, users, categories, links, posts, and comments. <em>For future reference, repeat the above steps in order to backup your installation of WordPress on a regular schedule.</em></p><h3 id="7572">Download important files and directories</h3><p>Unless you have spent a considerable amount of time customizing core WordPress files, I think it is [generally] a good idea to take this opportunity (of moving to a new server) to install the latest distributions. Considering it is safe to assume that you have uploaded countless images and files for sharing to your exhsiting server, it would only make sense to move specific files or folders to the new. In order to do so, you&#8217;ll need to fire up your favorite FTP utility in order to download files locally to your computer.</p><p>Aside from whatever personal files or directories you have created that you wish to bring with you, I recommend that users quadruple check that they&#8217;ve saved the following:</p><ul><li><strong>.htaccess</strong> &#8211; This file is hidden by default. In order to copy the contents of this file &#8211; rewrite or redirect rules &#8211; you&#8217;ll need to show invisible files. Most FTP utilities offer the option under their &#8216;View&#8217; menu option.</li><li><strong>wp-config.php</strong> &#8211; This file contains the important bits of your installation including your database name, location, username, and password. If you plan on creating your new database to match the settings found in this file, save a local copy of this file to upload back into your WordPress directory.</li><li><strong>/wp-content/uploads</strong> &#8211; Extremely important directory! Any files or images that you have uploaded using the WordPress uploading interface (post editor) are stored in this directory. Forget to move this and you&#8217;ll discover all your images for posts (after database import) will be missing.</li><li><strong>/wp-content/plugins</strong> &#8211; Personally, I download my entire plugins folder to re-upload. If my site is working as it should with the existing plugins, why leave them out of the download / re-upload workflow when moving to a new host? Once you&#8217;ve imported yoru backup database, your WordPress install will look as it did on the previous host. If plugins are missing from the new installation, your site might not function as it should from the get-go.</li><li><strong>/wp-content/themes</strong> &#8211; The presentations folder for WordPress containing all the themes you&#8217;ve amassed over the years.</li></ul><h3 id="7573">Upload a new WordPress installation</h3><p>Download the latest release of WordPress from the <a
href="http://wordpress.org/download/" title="Download WordPress">Download</a> page. The current release as of this posting is version 2.1 which offers a handful of updates from previous versions. Check out the release notes <a
href="http://wordpress.org/development/2007/01/ella-21/" title="WordPress 2.1 Ella release notes">here</a>.</p><p
align="center"><img
src="http://5thirtyone.com/wp-content/uploads/2007/02/local_wordpress_stage.png" alt="Downloaded WordPress directory" /></p><p>Remember when we <a
href="http://5thirtyone.com/archives/757#7572">downloaded all the important files and folders</a> from the previous step? Drop them back into this new WordPress download in preparation for upload. Ensure that <em>wp-config.php</em> remains in the root directory while plugins, uploads, and themes are placed in the <em>wp-content</em> directory. Once all the files are where they should be, open your FTP utility and upload the files and directories to your new server.</p><h3 id="7574">Create your WordPress database</h3><p>The first few minutes after logging into Plesk may be somewhat overwhelming. Worry not as Plesk is far simpler to navigate and use than you would ever imagine. By moving forward with the creation of your new WordPress database, we&#8217;re going to assume that you&#8217;ve familiarized yourself enough to understand the relationship of &#8220;Clients&#8221; and associated &#8220;Domains&#8221;. Moving forward, open the domain for which WordPress is to be installed. You&#8217;ll want to look for the &#8220;Services&#8221; section of the page.</p><p
align="center"><img
src="http://5thirtyone.com/wp-content/uploads/2007/02/plesk_services.png" alt="Plesk Services Options" /></p><p>Within the Services pane, select <em>Databases</em>. In the next view, select <em>Add New Database</em>. You will then provide the Database Name, ensure that type is MySQL, and make sure that Database Server is <em>Local MySQL Server</em>. Click OK. After the database is created, you&#8217;ll need to create an associated username and password. The database name, username, and password will then need to be referenced in the <em>wp-config.php</em> file located in your WordPress root directory to be uploaded to the new server.</p><h3 id="7575">Upload important files and directories</h3><p>All of the previously downloaded files &amp; directories including the newly edited <em>wp-config.php</em> file should then be uploaded to your new server. Take note to ensure that the original WordPress file directories are as they should be <em>/wp-content/uploads, /wp-content/plugins, and /wp-content/themes.</em></p><h3 id="7576">Import old database via SSH</h3><p>Chances are high that your database backup exceeds the 2MB upload limitation of phpMyAdmin. Fortunately, the database can still be upload &#8211; with a bit more finger work. You&#8217;ll need to complete the import via SSH (Secure Shell). In order to do this, your backup <em>must</em> be on your server. Upload your database into the root directory of your domain and open a command line utility. OS X users can open Terminal. Type the following to open an SSH session and hit [enter]. You will be prompted to enter your SSH/FTP password:</p><p><code>$ ssh username@domain.com</code></p><p>Where username is your SSH username and domain is the associated domain that you wish to import an existing database into. <em>Most likely will need to be an IP due to your domain not receiving the DNS change.</em> Once logged in, you&#8217;ll need to navigate to the directory where the backup database was uploaded. In this scenario, your root HTML directory. If you are unsure of the correct path, simply type the following followed by [enter]:</p><p><code>$ ls</code></p><p><strong>ls</strong> is an abbreviation of <em>list segments</em>. Entering ls followed by [enter] will present you with a list of directories &amp; files on your server. In the case of Dedicated Virtual users, <strong>cd</strong> or <em>change directory</em> where the backup exists:</p><p><code>$ cd httpdocs</code></p><p>Now that you are in the correct directory, you can import your WordPress backup into an existing [empty] database on your server:</p><p><code>$ mysql -u username -p databasename &lt; backup.sql</code></p><p>Enter the string above and hit [enter] after which you will be prompted for the password for the existing database. <em>Username</em> refers to the username associated with the database, <em>databasename</em> the name of the existing database, and <em>backup.sql</em> being the backup uploaded via FTP from the old server. [<a
href="http://kb.mediatemple.net/article.php?id=129">More Info</a>] Once the import is complete, logout and delete the backup from your HTML directory.</p><h3 id="7577">Double-check your website before requesting DNS change</h3><p>Now is the time to double-check your import and installation to ensure that everything is in working order. Because your domain is not yet pointing towards your new host, you&#8217;ll need to navigate using the IP or by selecting the &#8216;Site Preview&#8217; in Plesk. Now is also a great time to create your Mail aliases or accounts for forwarding or setup via Plesk in order to ensure that no emails are lost during the DNS change.</p><h3 id="7578">The best time to request a DNS change?</h3><p>The best time of day to request an official DNS change from your host depends on your readership. Reference your statistics tracking package for a better idea of what hours net the least number of readers. Doing so will ensure that any downtime as your DNS resolves will not result in disoriented and / or confused readers. <em>Recommended time for a DNS change would be between the hours of 2AM and 5AM. Your results may vary.</em></p><div
id="wherego_related"><h3>Readers Also Read</h3><ul><li><a
href="http://5thirtyone.com/archives/2046" rel="bookmark" class="wherego_title">VirtualHostX: Easy Virtual Hosting configuration on OS X</a></li><li><a
href="http://5thirtyone.com/archives/750" rel="bookmark" class="wherego_title">OS X Tip: Keep Desktop items on your desktop</a></li><li><a
href="http://5thirtyone.com/archives/759" rel="bookmark" class="wherego_title">Designers, don&#8217;t give your work away for free</a></li><li><a
href="http://5thirtyone.com/archives/1083" rel="bookmark" class="wherego_title">10 step guide for improving a vanilla WordPress install</a></li><li><a
href="http://5thirtyone.com/archives/835" rel="bookmark" class="wherego_title">Media Temple offers iPhone &quot;friendly&quot; AccountCenter</a></li></ul></div>]]></content:encoded> <wfw:commentRss>http://5thirtyone.com/archives/757/feed</wfw:commentRss> <slash:comments>54</slash:comments> </item> <item><title>Custom WordPress Database Error</title><link>http://5thirtyone.com/archives/408</link> <comments>http://5thirtyone.com/archives/408#comments</comments> <pubDate>Sat, 24 Jun 2006 05:07:59 +0000</pubDate> <dc:creator>Derek</dc:creator> <category><![CDATA[Tutorial]]></category> <category><![CDATA[database]]></category> <category><![CDATA[error]]></category> <category><![CDATA[WordPress]]></category><guid
isPermaLink="false">http://5thirtyone.com/archives/408</guid> <description><![CDATA[UPDATE 12/31: As of WordPress version 2.3.2, users can now easily replace their Database error using wp-content/db-error.php as their error template.
If you&#8217;re a longtime WordPress user, you&#8217;re probably aware of the Database Error page which rears its not so shiny face whenever your MySQL server decides to take a bathroom break. There&#8217;s no shame in [...]]]></description> <content:encoded><![CDATA[<p><strong>UPDATE 12/31:</strong> As of <a
href="http://wordpress.org/development/2007/12/wordpress-232/">WordPress version 2.3.2</a>, users can now easily replace their Database error using <code>wp-content/db-error.php</code> as their error template.</p><p>If you&#8217;re a longtime WordPress user, you&#8217;re probably aware of the Database Error page which rears its not so shiny face whenever your MySQL server decides to take a bathroom break. There&#8217;s no shame in enjoying the default error page which comes prepackaged with WordPress. It simple, <em>effective</em>, plain, did I say plain yet? Yes it&#8217;s plain.</p><p>After noticing that 5ThirtyOne was dead in the water due to server downtime, I decided the default error page had to go.</p><p
align="center"><a
href="http://www.flickr.com/photos/0401/173620342/" title="Full preview on Flickr" rel="external"><img
src="http://5thirtyone.com/wp-content/uploads/2006/06/dberrorpage.png" alt="custom wordpress error page" /></a></p><p>Fortunately, swapping the default is quite simple and something that I highly recommend to any and all WordPress users. There&#8217;s a certain sense of &#8220;professionalism&#8221; to WordPress sites which customize the smallest details to match their entire site through and through.<span
id="more-408"></span></p><h3>Where is the database error template served?</h3><p>WordPress 2.0+ users can find the necessary lines to edit within <em>&#8216;/wp-includes/wp-db.php&#8217;</em>. Beginning immediately below line 307, paste the following:</p><p><code>/* custom error page hack<br
/> shows a custom error page and emails error instead of<br
/> showing the default wordpress database error page */<br
/> include('wp-content/themes/themename/dbase-error.php');<br
/> $error = ( !$this-&gt;show_errors ) ? '' : $this-&gt;show_errors ;<br
/> mail('admin@domain.com', 'WordPress Error', $error);<br
/> die;<br
/> /* end custom error page hack */</code></p><p>For a hand-holding walk-through of each snippet of code, head on over to <a
href="http://allforces.com/2006/06/18/custom-wordpress-errors/" title="All Forces - WordPress Error page" rel="external">All Forces</a> where Melvin breaks down the little stuff. The most important details should be recognizeable above: a) the path to your custom template titled <strong>dbase-error.php</strong>, and b) the email address that WordPress should notify in case of emergency.</p><h3>A simple template to get you started</h3><p>Once you&#8217;ve made the appropriate edits within <strong>wp-db.php</strong>, you can now move on to creating a suitable error page to match the look and feel of your site. Below I&#8217;ve shared a little sample of code to get you started. Feel free to download a physical copy of <a
href="http://5thirtyone.com/sandbox/wordpress/dbase-error.php.zip" title="Download dbase-error.php.zip">dbase-error.php</a> for upload.</p><p><code>&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;<br
/> &lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;<br
/> &lt;head profile=&quot;http://gmpg.org/xfn/11&quot;&gt;<br
/> &lt;title&gt;My server crashed, please call the next of kin&lt;/title&gt;<br
/> &lt;style type=&quot;text/css&quot;&gt;<br
/> body {<br
/> font-family: arial, verdana, sans-serif;<br
/> font-size: 62.5%;<br
/> line-height: 1.7em;<br
/> background: #fff;<br
/> color: #333;<br
/> text-align: center;<br
/> }<br
/> a {<br
/> text-decoration: none;<br
/> outline: none;<br
/> }<br
/> #error_wrapper {<br
/> font-size: 1.3em;<br
/> margin: 2em auto 0;<br
/> text-align: left;<br
/> width: 333px;<br
/> }<br
/> .content_wrapper {<br
/> padding: 1em 0.7em 0;<br
/> }<br
/> &lt;/style&gt;<br
/> &lt;/head&gt;<br
/> &lt;body&gt;<br
/> &lt;div id=&quot;error_wrapper&quot;&gt;<br
/> &lt;div class=&quot;content_wrapper&quot;&gt;<br
/> &lt;p&gt;It looks as though my server has taken an unsupervised leave of absence. I may not know of its whereabouts so would you be so kind as to notify me via &lt;a href=&quot;mailto:admin@domain.com&quot; title=&quot;Send me an email&quot;&gt;email&lt;/a&gt;?&lt;/p&gt;<br
/> &lt;/div&gt;<br
/> &lt;/div&gt;<br
/> &lt;/body&gt;<br
/> &lt;/html&gt;</code></p><p>I&#8217;ve chosen to embed the CSS for the sake of convenience. If your error page begins to get a little disorganized, moving your stylesheet to an external source may be a more suitable route. Make note that all references to files within WordPress must be absolute paths.</p><h3>Show me yours</h3><p>Now that you have a clean canvas to work with, show me what your database error message will be. Being that errors are few and far between, I&#8217;ve pasted mine below:</p><blockquote><p>Unfortunately, it seems that 5ThirtyOne is suffering from a database error which prevents this WordPress driven site from delivering the content which you so desperately seek.</p><p>Rest assured that the lemmings living within the servers are hastily working to restore the MySQL database making everyone &#8211; especially me &#8211; a little less irritated.</p><p>If I broke my own site on accident, I really didn&#8217;t mean to. Change is good though right?</p></blockquote><p>Let&#8217;s try to be original. If there&#8217;s one thing worse than copying someones &#8216;<a
href="http://5thirtyone.com/colophon" title="5ThirtyOne Colophon">About</a>&#8216; page, it&#8217;s copying someones error page. Drop your renditions in the comments.</p><div
id="wherego_related"><h3>Readers Also Read</h3><ul><li><a
href="http://5thirtyone.com/archives/404" rel="bookmark" class="wherego_title">Wufoo does web forms right</a></li><li><a
href="http://5thirtyone.com/archives/1921" rel="bookmark" class="wherego_title">Sample WordPress content for development</a></li></ul></div>]]></content:encoded> <wfw:commentRss>http://5thirtyone.com/archives/408/feed</wfw:commentRss> <slash:comments>22</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (user agent is rejected)
Database Caching 11/25 queries in 0.027 seconds using disk

Served from: 5thirtyone.com @ 2010-03-17 19:36:13 -->