<?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>rabidGadfly &#187; PHP</title>
	<atom:link href="http://rabidgadfly.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://rabidgadfly.com</link>
	<description>Simple Solutions to Nagging Coding Problems</description>
	<lastBuildDate>Wed, 19 Oct 2011 13:43:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>WordPress Install/Upgrade Issues Linger in 2.6.2</title>
		<link>http://rabidgadfly.com/2008/09/wordpress-installupgrade-issues-linger-in-262/</link>
		<comments>http://rabidgadfly.com/2008/09/wordpress-installupgrade-issues-linger-in-262/#comments</comments>
		<pubDate>Thu, 18 Sep 2008 15:45:37 +0000</pubDate>
		<dc:creator>rabidgadfly</dc:creator>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[wordpress installation]]></category>
		<category><![CDATA[wordpress upgrade]]></category>

		<guid isPermaLink="false">http://www.rabidgadfly.com/?p=78</guid>
		<description><![CDATA[Back in March I wrote a post detailing the issues I had upgrading to an earlier release of WordPress 2. One of the issues was that I use custom table prefixes and they weren&#8217;t being read correctly by the upgrade script. My solution at that time was to hard-code the table names into the script. [...]]]></description>
			<content:encoded><![CDATA[<p>Back in March I wrote a post detailing the issues I had upgrading to an earlier release of WordPress 2. One of the issues was that I use custom table prefixes and they weren&#8217;t being read correctly by the upgrade script.</p>
<p>My solution at that time was to hard-code the table names into the script. Since that time, I&#8217;ve upgraded the same blog to a newer version and all went well.</p>
<p>I saw the issue again when trying to upgrade from a pre-2.0 version. Once again, the prefixes were not being read correctly. Since this was a small blog so I decided to simply install a fresh version of WordPress and import the old posts, but I ran into the same problem with a fresh installation!</p>
<p>This time I realized that not only were the table prefixes missing but so was the database name. I looked into it a little further and found that the instantiation of the $wpdb global variable in wp-admin/includes/upgrade.php was not working correctly.</p>
<p>I&#8217;m not a PHP guru, but if I understand how this is supposed to work, $wpdb is responsible for retrieving the database name and prefix from the WordPress configuration and insert that information into the script.</p>
<p>I passed this information to a coworker of mine who is more knowledgeable in the ways of PHP and he suggested two things. First, to use error_log() to log the possible error and second, to use print_r() to output $wpdb to the screen before the sql scripts ran. This would give me a better idea of what the problem was by displaying the contents of $wpdb.</p>
<p>So, I placed the following statement on line 62 of upgrade.php, after the $wpdb declaration and just above its first use:</p>
<pre>
<code>
error_log($wpdb->terms);
print_r($wpdb);
</code>
</pre>
<p>As my coworker stated, the sql was dumped onto the page, but, strangely enough everything looked fine. There were no longer any errors!</p>
<p>It seems as if either the error_log() or the print_r() functions actually fixed the issue. My only guess is that $wpdb was not properly instantiated and one of the functions I used to troubleshoot actually instantiated it.</p>
<p>Obviously, this is not a problem with all WordPress upgrades and installations. Most people have had no issues at all, but I&#8217;ve seen enough posts out there to know that I&#8217;m not alone as far as the issues go. My best guess is that it has something to do with the installation PLUS my server configuration.</p>
<p>I&#8217;m using PHP 5 and my coworker informed me that the upgrade was done for PHP 4. Obviously, the code has to continue to cover PHP 4. I&#8217;m just wondering if there&#8217;s a glitch involving the PHP version and possibly the PHP server configuration that&#8217;s causing issues with the upgrade code.</p>
<p>-rG</p>
]]></content:encoded>
			<wfw:commentRss>http://rabidgadfly.com/2008/09/wordpress-installupgrade-issues-linger-in-262/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

