<?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>Rui Miguel Feio &#187; Tech &#8211; Web Development</title>
	<atom:link href="http://www.ruifeio.com/category/web-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ruifeio.com</link>
	<description>Sharing knowledge with the world</description>
	<lastBuildDate>Wed, 08 Sep 2010 18:17:44 +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>PHP parameter session.gc_maxlifetime is lower that cookie validity configured in phpMyAdmin</title>
		<link>http://www.ruifeio.com/2009/12/05/php-parameter-session-gc_maxlifetime-is-lower-that-cookie-validity-configured-in-phpmyadmin/</link>
		<comments>http://www.ruifeio.com/2009/12/05/php-parameter-session-gc_maxlifetime-is-lower-that-cookie-validity-configured-in-phpmyadmin/#comments</comments>
		<pubDate>Sat, 05 Dec 2009 11:55:22 +0000</pubDate>
		<dc:creator>Rui Miguel Feio</dc:creator>
				<category><![CDATA[PhpMyAdmin]]></category>
		<category><![CDATA[WAMP]]></category>

		<guid isPermaLink="false">http://www.ruifeio.com/?p=432</guid>
		<description><![CDATA[If you have installed a new MySQL version you may be getting the following warning message: Your PHP parameter session.gc_maxlifetime is lower that cookie validity configured in phpMyAdmin, because of this, your login will expire sooner than configured in phpMyAdmin. To solve this issue we first need to check what the session.gc_maxlifetime value is in [...]]]></description>
			<content:encoded><![CDATA[<p>If you have installed a new MySQL version you may be getting the following warning message:</p>
<p><code style="font-size: 12px">Your PHP parameter session.gc_maxlifetime is lower that cookie validity configured in phpMyAdmin, because of this, your login will expire sooner than configured in phpMyAdmin.</code></p>
<p>To solve this issue we first need to check what the <code style="font-size: 12px">session.gc_maxlifetime</code> value is in <code style="font-size: 12px">php.ini</code> and what the <code style="font-size: 12px">$cfg['LoginCookieValidity']</code> is in config.inc.php.</p>
<p><strong>Example:</strong></p>
<p>1. php.ini</p>
<p><code style="font-size: 12px">session.gc_maxlifetime = 1440</code></p>
<p>2. config.inc.php</p>
<p><code style="font-size: 12px">$cfg['LoginCookieValidity'] = 1800;</code></p>
<p>Now, we only need to make these two values the same. For the sake of this example, we will change the value of <code style="font-size: 12px">$cfg['LoginCookieValidity']</code> to 1440.</p>
<p>After saving the changes we need to restart the services to make them effective.</p>
<p><strong>Notes:</strong></p>
<p>1.The php.ini file can be found on the php folder.</p>
<p>2. The config.inc.php file can be found on the phpmyadmin folder.</p>
<hr/>
<p>If you&#8217;re interested in learning more about PhpMyAdmin then check out the book &#8220;<a href="http://www.ruifeio.com/mastering-phpmyadmin" onclick="return TrackClick('http%3A%2F%2Fwww.ruifeio.com%2Fmastering-phpmyadmin','Mastering+PhpMydmin+for+Effective+MySQL+Management')">Mastering PhpMydmin for Effective MySQL Management</a>&#8220;.</p>
<hr/>
<div class="fullcircle-social-links" style="display: block;"></div><div style="clear: both;"></div>
<div class="sociable">

<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="mailto:?subject=PHP%20parameter%20session.gc_maxlifetime%20is%20lower%20that%20cookie%20validity%20configured%20in%20phpMyAdmin&amp;body=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F12%2F05%2Fphp-parameter-session-gc_maxlifetime-is-lower-that-cookie-validity-configured-in-phpmyadmin%2F" title="email"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="javascript:AddToFavorites();" title="Add to favorites"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/addtofavorites.png" title="Add to favorites" alt="Add to favorites" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F12%2F05%2Fphp-parameter-session-gc_maxlifetime-is-lower-that-cookie-validity-configured-in-phpmyadmin%2F&amp;t=PHP%20parameter%20session.gc_maxlifetime%20is%20lower%20that%20cookie%20validity%20configured%20in%20phpMyAdmin" title="Facebook"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=PHP%20parameter%20session.gc_maxlifetime%20is%20lower%20that%20cookie%20validity%20configured%20in%20phpMyAdmin%20-%20http%3A%2F%2Fwww.ruifeio.com%2F2009%2F12%2F05%2Fphp-parameter-session-gc_maxlifetime-is-lower-that-cookie-validity-configured-in-phpmyadmin%2F" title="Twitter"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F12%2F05%2Fphp-parameter-session-gc_maxlifetime-is-lower-that-cookie-validity-configured-in-phpmyadmin%2F&amp;t=PHP%20parameter%20session.gc_maxlifetime%20is%20lower%20that%20cookie%20validity%20configured%20in%20phpMyAdmin" title="MySpace"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F12%2F05%2Fphp-parameter-session-gc_maxlifetime-is-lower-that-cookie-validity-configured-in-phpmyadmin%2F&amp;title=PHP%20parameter%20session.gc_maxlifetime%20is%20lower%20that%20cookie%20validity%20configured%20in%20phpMyAdmin&amp;notes=If%20you%20have%20installed%20a%20new%20MySQL%20version%20you%20may%20be%20getting%20the%20following%20warning%20message%3A%0D%0A%0D%0AYour%20PHP%20parameter%20session.gc_maxlifetime%20is%20lower%20that%20cookie%20validity%20configured%20in%20phpMyAdmin%2C%20because%20of%20this%2C%20your%20login%20will%20expire%20sooner%20than%20confi" title="del.icio.us"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F12%2F05%2Fphp-parameter-session-gc_maxlifetime-is-lower-that-cookie-validity-configured-in-phpmyadmin%2F&amp;title=PHP%20parameter%20session.gc_maxlifetime%20is%20lower%20that%20cookie%20validity%20configured%20in%20phpMyAdmin&amp;source=Rui+Miguel+Feio+Sharing+knowledge+with+the+world&amp;summary=If%20you%20have%20installed%20a%20new%20MySQL%20version%20you%20may%20be%20getting%20the%20following%20warning%20message%3A%0D%0A%0D%0AYour%20PHP%20parameter%20session.gc_maxlifetime%20is%20lower%20that%20cookie%20validity%20configured%20in%20phpMyAdmin%2C%20because%20of%20this%2C%20your%20login%20will%20expire%20sooner%20than%20confi" title="LinkedIn"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F12%2F05%2Fphp-parameter-session-gc_maxlifetime-is-lower-that-cookie-validity-configured-in-phpmyadmin%2F&amp;title=PHP%20parameter%20session.gc_maxlifetime%20is%20lower%20that%20cookie%20validity%20configured%20in%20phpMyAdmin&amp;bodytext=If%20you%20have%20installed%20a%20new%20MySQL%20version%20you%20may%20be%20getting%20the%20following%20warning%20message%3A%0D%0A%0D%0AYour%20PHP%20parameter%20session.gc_maxlifetime%20is%20lower%20that%20cookie%20validity%20configured%20in%20phpMyAdmin%2C%20because%20of%20this%2C%20your%20login%20will%20expire%20sooner%20than%20confi" title="Digg"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F12%2F05%2Fphp-parameter-session-gc_maxlifetime-is-lower-that-cookie-validity-configured-in-phpmyadmin%2F&amp;title=PHP%20parameter%20session.gc_maxlifetime%20is%20lower%20that%20cookie%20validity%20configured%20in%20phpMyAdmin" title="StumbleUpon"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F12%2F05%2Fphp-parameter-session-gc_maxlifetime-is-lower-that-cookie-validity-configured-in-phpmyadmin%2F&amp;title=PHP%20parameter%20session.gc_maxlifetime%20is%20lower%20that%20cookie%20validity%20configured%20in%20phpMyAdmin&amp;annotation=If%20you%20have%20installed%20a%20new%20MySQL%20version%20you%20may%20be%20getting%20the%20following%20warning%20message%3A%0D%0A%0D%0AYour%20PHP%20parameter%20session.gc_maxlifetime%20is%20lower%20that%20cookie%20validity%20configured%20in%20phpMyAdmin%2C%20because%20of%20this%2C%20your%20login%20will%20expire%20sooner%20than%20confi" title="Google Bookmarks"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F12%2F05%2Fphp-parameter-session-gc_maxlifetime-is-lower-that-cookie-validity-configured-in-phpmyadmin%2F&amp;submitHeadline=PHP%20parameter%20session.gc_maxlifetime%20is%20lower%20that%20cookie%20validity%20configured%20in%20phpMyAdmin&amp;submitSummary=If%20you%20have%20installed%20a%20new%20MySQL%20version%20you%20may%20be%20getting%20the%20following%20warning%20message%3A%0D%0A%0D%0AYour%20PHP%20parameter%20session.gc_maxlifetime%20is%20lower%20that%20cookie%20validity%20configured%20in%20phpMyAdmin%2C%20because%20of%20this%2C%20your%20login%20will%20expire%20sooner%20than%20confi&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.indianpad.com/submit.php?url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F12%2F05%2Fphp-parameter-session-gc_maxlifetime-is-lower-that-cookie-validity-configured-in-phpmyadmin%2F" title="IndianPad"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/indianpad.png" title="IndianPad" alt="IndianPad" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ruifeio.com/2009/12/05/php-parameter-session-gc_maxlifetime-is-lower-that-cookie-validity-configured-in-phpmyadmin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Notice:  Undefined index: message in /home/example.php on line 9</title>
		<link>http://www.ruifeio.com/2009/09/28/notice-undefined-index-message-in-hometestexample-php-on-line-3/</link>
		<comments>http://www.ruifeio.com/2009/09/28/notice-undefined-index-message-in-hometestexample-php-on-line-3/#comments</comments>
		<pubDate>Mon, 28 Sep 2009 20:25:46 +0000</pubDate>
		<dc:creator>Rui Miguel Feio</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.ruifeio.com/?p=390</guid>
		<description><![CDATA[If  you&#8217;re getting this message on PHP this is due to your PHP error reporting settings not being set correctly. You can suppress the Notice warnings by changing the error reporting settings on PHP.ini (permanent change) or adding an extra line to your PHP script. Changing PHP.ini: Changing your PHP.ini makes the change permanent and [...]]]></description>
			<content:encoded><![CDATA[<p>If  you&#8217;re getting this message on PHP this is due to your PHP error reporting settings not being set correctly.</p>
<p>You can suppress the Notice warnings by changing the error reporting settings on PHP.ini (permanent change) or adding an extra line to your PHP script.</p>
<p><strong>Changing PHP.ini:</strong></p>
<p>Changing your PHP.ini makes the change permanent and available to every PHP script you run.</p>
<ol>
<li>Edit your PHP.ini file</li>
<li>Locate the line that has <em>error_reporting</em> without the <em>;</em> in the beginning (ex: <em>error_reporting = E_ALL</em>)</li>
<li>Change this to <em>error_reporting = E_ALL &amp; ~E_NOTICE</em></li>
<li>Save PHP.ini</li>
</ol>
<p><strong>Adding line to your script:</strong></p>
<p>Just add the following line to the beginning of your script:</p>
<p><em>error_reporting (E_ALL ^ E_NOTICE);</em></p>
<p><strong>Explanation:</strong></p>
<p><em>error_reporting = E_ALL &amp; ~E_NOTICE</em> tells the system to show all errors and warnings except those for notices.</p>
<div class="fullcircle-social-links" style="display: block;"></div><div style="clear: both;"></div>
<div class="sociable">

<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="mailto:?subject=Notice%3A%20%20Undefined%20index%3A%20message%20in%20%2Fhome%2Fexample.php%20on%20line%209&amp;body=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F09%2F28%2Fnotice-undefined-index-message-in-hometestexample-php-on-line-3%2F" title="email"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="javascript:AddToFavorites();" title="Add to favorites"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/addtofavorites.png" title="Add to favorites" alt="Add to favorites" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F09%2F28%2Fnotice-undefined-index-message-in-hometestexample-php-on-line-3%2F&amp;t=Notice%3A%20%20Undefined%20index%3A%20message%20in%20%2Fhome%2Fexample.php%20on%20line%209" title="Facebook"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Notice%3A%20%20Undefined%20index%3A%20message%20in%20%2Fhome%2Fexample.php%20on%20line%209%20-%20http%3A%2F%2Fwww.ruifeio.com%2F2009%2F09%2F28%2Fnotice-undefined-index-message-in-hometestexample-php-on-line-3%2F" title="Twitter"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F09%2F28%2Fnotice-undefined-index-message-in-hometestexample-php-on-line-3%2F&amp;t=Notice%3A%20%20Undefined%20index%3A%20message%20in%20%2Fhome%2Fexample.php%20on%20line%209" title="MySpace"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F09%2F28%2Fnotice-undefined-index-message-in-hometestexample-php-on-line-3%2F&amp;title=Notice%3A%20%20Undefined%20index%3A%20message%20in%20%2Fhome%2Fexample.php%20on%20line%209&amp;notes=If%C2%A0%20you%27re%20getting%20this%20message%20on%20PHP%20this%20is%20due%20to%20your%20PHP%20error%20reporting%20settings%20not%20being%20set%20correctly.%0D%0A%0D%0AYou%20can%20suppress%20the%20Notice%20warnings%20by%20changing%20the%20error%20reporting%20settings%20on%20PHP.ini%20%28permanent%20change%29%20or%20adding%20an%20extra%20line%20t" title="del.icio.us"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F09%2F28%2Fnotice-undefined-index-message-in-hometestexample-php-on-line-3%2F&amp;title=Notice%3A%20%20Undefined%20index%3A%20message%20in%20%2Fhome%2Fexample.php%20on%20line%209&amp;source=Rui+Miguel+Feio+Sharing+knowledge+with+the+world&amp;summary=If%C2%A0%20you%27re%20getting%20this%20message%20on%20PHP%20this%20is%20due%20to%20your%20PHP%20error%20reporting%20settings%20not%20being%20set%20correctly.%0D%0A%0D%0AYou%20can%20suppress%20the%20Notice%20warnings%20by%20changing%20the%20error%20reporting%20settings%20on%20PHP.ini%20%28permanent%20change%29%20or%20adding%20an%20extra%20line%20t" title="LinkedIn"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F09%2F28%2Fnotice-undefined-index-message-in-hometestexample-php-on-line-3%2F&amp;title=Notice%3A%20%20Undefined%20index%3A%20message%20in%20%2Fhome%2Fexample.php%20on%20line%209&amp;bodytext=If%C2%A0%20you%27re%20getting%20this%20message%20on%20PHP%20this%20is%20due%20to%20your%20PHP%20error%20reporting%20settings%20not%20being%20set%20correctly.%0D%0A%0D%0AYou%20can%20suppress%20the%20Notice%20warnings%20by%20changing%20the%20error%20reporting%20settings%20on%20PHP.ini%20%28permanent%20change%29%20or%20adding%20an%20extra%20line%20t" title="Digg"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F09%2F28%2Fnotice-undefined-index-message-in-hometestexample-php-on-line-3%2F&amp;title=Notice%3A%20%20Undefined%20index%3A%20message%20in%20%2Fhome%2Fexample.php%20on%20line%209" title="StumbleUpon"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F09%2F28%2Fnotice-undefined-index-message-in-hometestexample-php-on-line-3%2F&amp;title=Notice%3A%20%20Undefined%20index%3A%20message%20in%20%2Fhome%2Fexample.php%20on%20line%209&amp;annotation=If%C2%A0%20you%27re%20getting%20this%20message%20on%20PHP%20this%20is%20due%20to%20your%20PHP%20error%20reporting%20settings%20not%20being%20set%20correctly.%0D%0A%0D%0AYou%20can%20suppress%20the%20Notice%20warnings%20by%20changing%20the%20error%20reporting%20settings%20on%20PHP.ini%20%28permanent%20change%29%20or%20adding%20an%20extra%20line%20t" title="Google Bookmarks"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F09%2F28%2Fnotice-undefined-index-message-in-hometestexample-php-on-line-3%2F&amp;submitHeadline=Notice%3A%20%20Undefined%20index%3A%20message%20in%20%2Fhome%2Fexample.php%20on%20line%209&amp;submitSummary=If%C2%A0%20you%27re%20getting%20this%20message%20on%20PHP%20this%20is%20due%20to%20your%20PHP%20error%20reporting%20settings%20not%20being%20set%20correctly.%0D%0A%0D%0AYou%20can%20suppress%20the%20Notice%20warnings%20by%20changing%20the%20error%20reporting%20settings%20on%20PHP.ini%20%28permanent%20change%29%20or%20adding%20an%20extra%20line%20t&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.indianpad.com/submit.php?url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F09%2F28%2Fnotice-undefined-index-message-in-hometestexample-php-on-line-3%2F" title="IndianPad"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/indianpad.png" title="IndianPad" alt="IndianPad" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ruifeio.com/2009/09/28/notice-undefined-index-message-in-hometestexample-php-on-line-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>phpMyAdmin root with no password message</title>
		<link>http://www.ruifeio.com/2009/09/17/phpmyadmin-root-with-no-password-message/</link>
		<comments>http://www.ruifeio.com/2009/09/17/phpmyadmin-root-with-no-password-message/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 11:35:53 +0000</pubDate>
		<dc:creator>Rui Miguel Feio</dc:creator>
				<category><![CDATA[PhpMyAdmin]]></category>
		<category><![CDATA[WAMP]]></category>

		<guid isPermaLink="false">http://www.ruifeio.com/?p=380</guid>
		<description><![CDATA[After installing WAMP Server it is common when you first access phpMyAdmin to get the following message: &#8220;Your configuration file contains settings (root with no password) that correspond to the default MySQL privileged account. Your MySQL server is running with this default, is open to intrusion, and you really should fix this security hole by [...]]]></description>
			<content:encoded><![CDATA[<p>After installing WAMP Server it is common when you first access phpMyAdmin to get the following message:</p>
<p>&#8220;Your configuration file contains settings (root with no password) that correspond to the default MySQL privileged account. Your MySQL server is running with this default, is open to intrusion, and you really should fix this security hole by setting a password for user &#8216;.root&#8217;.&#8221;</p>
<p><strong>To correct this security issue you need to do the following:</strong></p>
<ol>
<li>Go to <em>phpMyAdmin</em></li>
<li>Select the <em>Privileges</em> tab</li>
<li>Locate the user &#8220;<em>root</em>&#8221; that has <em>localhost </em>for a host</li>
<li>Edit the root user privileges by clicking on the corresponding <em>Edit Privileges</em> button</li>
<li>On the <em>Change Password</em> section insert the desired password and press <em>Go</em></li>
<li>You should now have at the top of the screen the message: &#8220;<em>The password for &#8216;root&#8217;@'localhost&#8217; was changed successfully.</em>&#8220;</li>
<li>Now you need to edit file <em>config.inc.php</em> normally located at <em>C:\wamp\apps\phpmyadmin3.2.0.1</em> (note that the version indication may  vary)</li>
<li>Locate <em>$cfg['Servers'][$i]['auth_type'] = &#8216;config&#8217;;</em> and change from <em>config </em>to <em>cookie </em>so that you get a login window every time you access phpMyAdmin</li>
<li>Locate <em>$cfg['blowfish_secret'] = &#8216;  &#8216;;</em> line. If you don&#8217;t have one add it to your <em>config.inc.php</em> file</li>
<li>Add a secret passphrase to <em>$cfg['blowfish_secret'] = &#8216;  &#8216;;</em> for example: <em>$cfg['blowfish_secret'] = &#8216;secret_pass&#8217;;</em></li>
<li>Save your changes</li>
<li>Go to the WAMPServer and select <em>Restart All Services</em></li>
<li>Once all the services have been restarted go to <em>phpMyAdmin</em> and enter the username root and your password to access phpMyAmdin</li>
</ol>
<p><strong>Notes:</strong></p>
<ol>
<li>The <em>blowfish_secret</em> passphrase should not be the same as the root password.</li>
<li>If you don&#8217;t add a <em>$cfg['blowfish_secret']</em> line to the <em>config.inc.php</em> file, when you access phpMyAdmin you&#8217;ll get the message: &#8220;<em>The configuration file now needs a secret passphrase (blowfish_secret).</em>&#8220;</li>
</ol>
<hr/>
<p>If you&#8217;re interested in learning more about PhpMyAdmin then check out the book &#8220;<a href="http://www.ruifeio.com/mastering-phpmyadmin" onclick="return TrackClick('http%3A%2F%2Fwww.ruifeio.com%2Fmastering-phpmyadmin','Mastering+PhpMydmin+for+Effective+MySQL+Management')">Mastering PhpMydmin for Effective MySQL Management</a>&#8220;.</p>
<hr/>
<div class="fullcircle-social-links" style="display: block;"></div><div style="clear: both;"></div>
<div class="sociable">

<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="mailto:?subject=phpMyAdmin%20root%20with%20no%20password%20message&amp;body=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F09%2F17%2Fphpmyadmin-root-with-no-password-message%2F" title="email"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="javascript:AddToFavorites();" title="Add to favorites"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/addtofavorites.png" title="Add to favorites" alt="Add to favorites" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F09%2F17%2Fphpmyadmin-root-with-no-password-message%2F&amp;t=phpMyAdmin%20root%20with%20no%20password%20message" title="Facebook"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=phpMyAdmin%20root%20with%20no%20password%20message%20-%20http%3A%2F%2Fwww.ruifeio.com%2F2009%2F09%2F17%2Fphpmyadmin-root-with-no-password-message%2F" title="Twitter"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F09%2F17%2Fphpmyadmin-root-with-no-password-message%2F&amp;t=phpMyAdmin%20root%20with%20no%20password%20message" title="MySpace"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F09%2F17%2Fphpmyadmin-root-with-no-password-message%2F&amp;title=phpMyAdmin%20root%20with%20no%20password%20message&amp;notes=After%20installing%20WAMP%20Server%20it%20is%20common%20when%20you%20first%20access%20phpMyAdmin%20to%20get%20the%20following%20message%3A%0D%0A%0D%0A%22Your%20configuration%20file%20contains%20settings%20%28root%20with%20no%20password%29%20that%20correspond%20to%20the%20default%20MySQL%20privileged%20account.%20Your%20MySQL%20server%20" title="del.icio.us"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F09%2F17%2Fphpmyadmin-root-with-no-password-message%2F&amp;title=phpMyAdmin%20root%20with%20no%20password%20message&amp;source=Rui+Miguel+Feio+Sharing+knowledge+with+the+world&amp;summary=After%20installing%20WAMP%20Server%20it%20is%20common%20when%20you%20first%20access%20phpMyAdmin%20to%20get%20the%20following%20message%3A%0D%0A%0D%0A%22Your%20configuration%20file%20contains%20settings%20%28root%20with%20no%20password%29%20that%20correspond%20to%20the%20default%20MySQL%20privileged%20account.%20Your%20MySQL%20server%20" title="LinkedIn"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F09%2F17%2Fphpmyadmin-root-with-no-password-message%2F&amp;title=phpMyAdmin%20root%20with%20no%20password%20message&amp;bodytext=After%20installing%20WAMP%20Server%20it%20is%20common%20when%20you%20first%20access%20phpMyAdmin%20to%20get%20the%20following%20message%3A%0D%0A%0D%0A%22Your%20configuration%20file%20contains%20settings%20%28root%20with%20no%20password%29%20that%20correspond%20to%20the%20default%20MySQL%20privileged%20account.%20Your%20MySQL%20server%20" title="Digg"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F09%2F17%2Fphpmyadmin-root-with-no-password-message%2F&amp;title=phpMyAdmin%20root%20with%20no%20password%20message" title="StumbleUpon"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F09%2F17%2Fphpmyadmin-root-with-no-password-message%2F&amp;title=phpMyAdmin%20root%20with%20no%20password%20message&amp;annotation=After%20installing%20WAMP%20Server%20it%20is%20common%20when%20you%20first%20access%20phpMyAdmin%20to%20get%20the%20following%20message%3A%0D%0A%0D%0A%22Your%20configuration%20file%20contains%20settings%20%28root%20with%20no%20password%29%20that%20correspond%20to%20the%20default%20MySQL%20privileged%20account.%20Your%20MySQL%20server%20" title="Google Bookmarks"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F09%2F17%2Fphpmyadmin-root-with-no-password-message%2F&amp;submitHeadline=phpMyAdmin%20root%20with%20no%20password%20message&amp;submitSummary=After%20installing%20WAMP%20Server%20it%20is%20common%20when%20you%20first%20access%20phpMyAdmin%20to%20get%20the%20following%20message%3A%0D%0A%0D%0A%22Your%20configuration%20file%20contains%20settings%20%28root%20with%20no%20password%29%20that%20correspond%20to%20the%20default%20MySQL%20privileged%20account.%20Your%20MySQL%20server%20&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.indianpad.com/submit.php?url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F09%2F17%2Fphpmyadmin-root-with-no-password-message%2F" title="IndianPad"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/indianpad.png" title="IndianPad" alt="IndianPad" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ruifeio.com/2009/09/17/phpmyadmin-root-with-no-password-message/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Backup and Restore a web site in CPANEL</title>
		<link>http://www.ruifeio.com/2009/08/16/backup-and-restore-a-web-site-in-cpanel/</link>
		<comments>http://www.ruifeio.com/2009/08/16/backup-and-restore-a-web-site-in-cpanel/#comments</comments>
		<pubDate>Sun, 16 Aug 2009 20:18:46 +0000</pubDate>
		<dc:creator>Rui Miguel Feio</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.ruifeio.com/?p=246</guid>
		<description><![CDATA[It&#8217;s a good practice to make backups prior to submit any changes to your site. Time and again people skip the backup to find themselves with problems and not having an easy and quick way to undo their changes. This may not seem a big problem, but if the changes were done to the web [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s a good practice to make backups prior to submit any changes to your site.</p>
<p>Time and again people skip the backup to find themselves with problems and not having an easy and quick way to undo their changes. This may not seem a big problem, but if the changes were done to the web site of your business and now the web site is not working probably, this means you&#8217;re losing money!</p>
<p>Backing up a site is easy and even more if your web server uses CPANEL.</p>
<p><strong>Consider the following steps to BACKUP your site:</strong></p>
<ul>
<li>To Backup the files of your site:
<ol>
<li>On <em>CPANEL </em>select option <em>Backups</em></li>
<li>Under <em>Home Directory</em> select option <em>Download a home directory Backup</em></li>
<li>Select <em>Save File</em></li>
</ol>
</li>
<li>To Backup the Databases of your site:
<ol>
<li>On <em>CPANEL </em>select option Backups</li>
<li>Under <span><em>Download a MySQL Database Backup </em>select the Database you wish to Backup</span></li>
<li><span>Select <em>Save File</em></span></li>
<li><span>Repeat Steps 2 and 3 for any other Database you wish to backup</span></li>
</ol>
</li>
</ul>
<p><strong>Consider the following steps to RESTORE your site:</strong></p>
<ul>
<li>To Restore the files of your site:
<ol>
<li>On <em>CPANEL </em>select option <em>Backups</em></li>
<li>Under <em><span>Restore a Home Directory Backup </span></em><span>select <em>Browse </em>and locate the backup you want to restore from<br />
</span></li>
<li>Select <em>Upload</em></li>
</ol>
</li>
<li>To Restore the Databases of your site:
<ol>
<li>On <em>CPANEL </em>select option Backups</li>
<li>Under <em><span>Restore a MySQL Database</span></em><span><em> </em>select <em>Browse </em>and locate the backup you want to restore from.<br />
</span></li>
<li><span>Select <em>Upload</em></span></li>
<li><span>Repeat Steps 2 and 3 for any other Database you wish to restore</span></li>
</ol>
</li>
</ul>
<div class="fullcircle-social-links" style="display: block;"></div><div style="clear: both;"></div>
<div class="sociable">

<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="mailto:?subject=Backup%20and%20Restore%20a%20web%20site%20in%20CPANEL&amp;body=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F08%2F16%2Fbackup-and-restore-a-web-site-in-cpanel%2F" title="email"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="javascript:AddToFavorites();" title="Add to favorites"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/addtofavorites.png" title="Add to favorites" alt="Add to favorites" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F08%2F16%2Fbackup-and-restore-a-web-site-in-cpanel%2F&amp;t=Backup%20and%20Restore%20a%20web%20site%20in%20CPANEL" title="Facebook"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Backup%20and%20Restore%20a%20web%20site%20in%20CPANEL%20-%20http%3A%2F%2Fwww.ruifeio.com%2F2009%2F08%2F16%2Fbackup-and-restore-a-web-site-in-cpanel%2F" title="Twitter"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F08%2F16%2Fbackup-and-restore-a-web-site-in-cpanel%2F&amp;t=Backup%20and%20Restore%20a%20web%20site%20in%20CPANEL" title="MySpace"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F08%2F16%2Fbackup-and-restore-a-web-site-in-cpanel%2F&amp;title=Backup%20and%20Restore%20a%20web%20site%20in%20CPANEL&amp;notes=It%27s%20a%20good%20practice%20to%20make%20backups%20prior%20to%20submit%20any%20changes%20to%20your%20site.%0D%0A%0D%0ATime%20and%20again%20people%20skip%20the%20backup%20to%20find%20themselves%20with%20problems%20and%20not%20having%20an%20easy%20and%20quick%20way%20to%20undo%20their%20changes.%20This%20may%20not%20seem%20a%20big%20problem%2C%20but%20" title="del.icio.us"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F08%2F16%2Fbackup-and-restore-a-web-site-in-cpanel%2F&amp;title=Backup%20and%20Restore%20a%20web%20site%20in%20CPANEL&amp;source=Rui+Miguel+Feio+Sharing+knowledge+with+the+world&amp;summary=It%27s%20a%20good%20practice%20to%20make%20backups%20prior%20to%20submit%20any%20changes%20to%20your%20site.%0D%0A%0D%0ATime%20and%20again%20people%20skip%20the%20backup%20to%20find%20themselves%20with%20problems%20and%20not%20having%20an%20easy%20and%20quick%20way%20to%20undo%20their%20changes.%20This%20may%20not%20seem%20a%20big%20problem%2C%20but%20" title="LinkedIn"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F08%2F16%2Fbackup-and-restore-a-web-site-in-cpanel%2F&amp;title=Backup%20and%20Restore%20a%20web%20site%20in%20CPANEL&amp;bodytext=It%27s%20a%20good%20practice%20to%20make%20backups%20prior%20to%20submit%20any%20changes%20to%20your%20site.%0D%0A%0D%0ATime%20and%20again%20people%20skip%20the%20backup%20to%20find%20themselves%20with%20problems%20and%20not%20having%20an%20easy%20and%20quick%20way%20to%20undo%20their%20changes.%20This%20may%20not%20seem%20a%20big%20problem%2C%20but%20" title="Digg"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F08%2F16%2Fbackup-and-restore-a-web-site-in-cpanel%2F&amp;title=Backup%20and%20Restore%20a%20web%20site%20in%20CPANEL" title="StumbleUpon"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F08%2F16%2Fbackup-and-restore-a-web-site-in-cpanel%2F&amp;title=Backup%20and%20Restore%20a%20web%20site%20in%20CPANEL&amp;annotation=It%27s%20a%20good%20practice%20to%20make%20backups%20prior%20to%20submit%20any%20changes%20to%20your%20site.%0D%0A%0D%0ATime%20and%20again%20people%20skip%20the%20backup%20to%20find%20themselves%20with%20problems%20and%20not%20having%20an%20easy%20and%20quick%20way%20to%20undo%20their%20changes.%20This%20may%20not%20seem%20a%20big%20problem%2C%20but%20" title="Google Bookmarks"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F08%2F16%2Fbackup-and-restore-a-web-site-in-cpanel%2F&amp;submitHeadline=Backup%20and%20Restore%20a%20web%20site%20in%20CPANEL&amp;submitSummary=It%27s%20a%20good%20practice%20to%20make%20backups%20prior%20to%20submit%20any%20changes%20to%20your%20site.%0D%0A%0D%0ATime%20and%20again%20people%20skip%20the%20backup%20to%20find%20themselves%20with%20problems%20and%20not%20having%20an%20easy%20and%20quick%20way%20to%20undo%20their%20changes.%20This%20may%20not%20seem%20a%20big%20problem%2C%20but%20&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.indianpad.com/submit.php?url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F08%2F16%2Fbackup-and-restore-a-web-site-in-cpanel%2F" title="IndianPad"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/indianpad.png" title="IndianPad" alt="IndianPad" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ruifeio.com/2009/08/16/backup-and-restore-a-web-site-in-cpanel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to move a WordPress site to a different Server or URL</title>
		<link>http://www.ruifeio.com/2009/08/08/how-to-move-a-wordpress-site-to-a-different-server-or-url/</link>
		<comments>http://www.ruifeio.com/2009/08/08/how-to-move-a-wordpress-site-to-a-different-server-or-url/#comments</comments>
		<pubDate>Sat, 08 Aug 2009 18:10:01 +0000</pubDate>
		<dc:creator>Rui Miguel Feio</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.ruifeio.com/?p=203</guid>
		<description><![CDATA[Moving a WordPress site from one server to another or to a different Web address (URL) may seem a daunting task and something to stay away from. The truth is that it is quite simple! Last month I was asked to help moving a WordPress (WP) blog from one server to another and I thought [...]]]></description>
			<content:encoded><![CDATA[<p>Moving a WordPress site from one server to another or to a different Web address (URL) may seem a daunting task and something to stay away from. The truth is that it is quite simple!</p>
<p>Last month I was asked to help moving a WordPress (WP) blog from one server to another and I thought I should share with the world how this can be done.</p>
<p>Performing this task requires 3 major steps:</p>
<p>1. Move the WordPress Source Code<br />
2. Move the WordPress Database<br />
3. Update the WordPress configuration</p>
<p>For the sake of this example I will provide the general instructions for a WordPress running on LAMP (Lunix, Apache, MySQL and PHP) environment with CPanel and I&#8217;ll assume that we want to move it from http://www.original-server.com/blog to http://www.destination-server.com/blog.</p>
<p><strong>STEP 1 &#8211; Move the WordPress Source Code:</strong></p>
<p><em><span style="text-decoration: underline;"> (Original server)- Download the WordPress source files:</span></em></p>
<p>1. On <em>CPanel </em>select &#8220;<em>File Manager</em>&#8221;<br />
2. Tick (check) the folder that contains the WordPress blog source files (ex: blog)<br />
3. Select &#8220;<em>Compress</em>&#8221; from the menu<br />
4. Select &#8220;<em>Compress File(s)</em>&#8221;<br />
5. Tick (check) the <em>zip </em>file you&#8217;ve just created<br />
6. Select &#8220;<em>Download</em>&#8221; from the menu and save the <em>zip </em>file locally<br />
7. Once the download is finished delete the <em>zip </em>file from the server</p>
<p><em><span style="text-decoration: underline;">(Destination Server) &#8211; Upload the WordPress source code:</span></em></p>
<p>1. On <em>CPanel </em>select &#8220;<em>File Manager</em>&#8221;<br />
2. Select the &#8220;<em>Upload</em>&#8221; option<br />
3. Locate and select the <em>zip </em>file that contains the WordPress source code you&#8217;ve copied into your PC.<br />
4. Upload your file into the new server<br />
5. Select the <em>zip </em>file<br />
6. Select &#8220;<em>Extract</em>&#8221; from menu<br />
7. Delete <em>Zip </em>file from server</p>
<p>Note: Beware! When you <em>unzip </em>the file if a directory already exists with the same name its content will be replaced!</p>
<p><strong>STEP 2 &#8211; Move the WordPress Database:</strong></p>
<p><em><span style="text-decoration: underline;">(Original Server) &#8211; Export WordPress Database:</span></em></p>
<p>1. On <em>CPanel </em>select option &#8220;<em>phpMyAdmin</em>&#8221; (MySQL Databases)<br />
2. Select the WordPress Database that you want to export (ex: wp01)<br />
2. Select &#8220;<em>Export</em>&#8221;<br />
3. Make sure all the <em>Tables </em>are selected<br />
4. Leave all the default options ticked<br />
5. Make sure to download as an <em>SQL </em>file<br />
6. Check &#8220;<em>Save as File</em>&#8221;<br />
7. Click &#8220;<em>Go</em>&#8221; and save it locally</p>
<p>Note: In addition you may also select &#8220;<em>zipped</em>&#8221; or &#8220;<em>gzipped</em>&#8221; to compress your database when downloading it.</p>
<p><em><span style="text-decoration: underline;">(Destination Server) &#8211; Create new Database:</span></em></p>
<p>1. On <em>CPanel </em>select &#8220;<em>MySQL Databases</em>&#8221;<br />
2. Create a new <em>DB </em>for the blog (ex: wp01) and if possible with the same name as it had originally<br />
3. Create a new <em>user </em>for the blog if possible with the same name as originally<br />
4. Associate the new <em>user </em>with the WordPress <em>Database </em>you&#8217;ve just created and all privileges to it.</p>
<p><span style="text-decoration: underline;"><em>(Locally) &#8211; Update WordPress MySQL database:</em></span></p>
<p>1. Edit the WordPress SQL <em>database </em>you&#8217;ve downloaded from the original server.<br />
2. If the web address <em>URL </em>has changed:</p>
<ul>
<li>replace all references of the old <em>URL </em>with the new <em>URL</em></li>
<li> note that if on the new server you&#8217;re using a different directory, this needs to change too.</li>
</ul>
<p>3. If the email addresses have changed, replace them with the new addresses.<br />
4. Save your changes.</p>
<p><span style="text-decoration: underline;"><em>(Destination server) &#8211; Upload WordPress Database:</em></span></p>
<p>1. On <em>CPanel</em>, select &#8220;<em>phpMyAdmin</em>&#8221; (MySQL Databases)<br />
2. Select the WordPress <em>Database</em><br />
3. Select the &#8220;<em>Import</em>&#8221; option<br />
4. Locate and select the WordPress SQL <em>Database </em>you have saved locally.<br />
5. <em>Import </em>file</p>
<p><strong>STEP 3 &#8211; Update the WordPress configuration:</strong></p>
<p><em><span style="text-decoration: underline;">(Destination Server) &#8211; Update config file:</span></em></p>
<p>1. On <em>Cpanel </em>select &#8220;<em>File Manager</em>&#8221;<br />
2. Locate and edit WordPress configuration file &#8220;<em>wp-config.php</em>&#8221;<br />
3. Update WP <em>DB name</em> with the new WordPress Database name:   define(&#8216;DB_NAME&#8217;, &#8216;database_name_goes_here&#8217;);<br />
4. Update <em>user name</em>:  define(&#8216;DB_USER&#8217;, &#8216;user_name_goes_here&#8217;);<br />
5. Update <em>Database password</em>:  define(&#8216;DB_PASSWORD&#8217;, &#8216;password_goes_here&#8217;);<br />
6. Update <em>hostname </em>(if required):  define(&#8216;DB_HOST&#8217;, &#8216;hostname_goes_here&#8217;);<br />
7. Save your changes</p>
<p><strong>STEP 4 &#8211; Testing:</strong></p>
<p>1. Simply test your blog to make sure that all the functionalities are available</p>
<div class="fullcircle-social-links" style="display: block;"></div><div style="clear: both;"></div>
<div class="sociable">

<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="mailto:?subject=How%20to%20move%20a%20WordPress%20site%20to%20a%20different%20Server%20or%20URL&amp;body=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F08%2F08%2Fhow-to-move-a-wordpress-site-to-a-different-server-or-url%2F" title="email"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="javascript:AddToFavorites();" title="Add to favorites"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/addtofavorites.png" title="Add to favorites" alt="Add to favorites" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F08%2F08%2Fhow-to-move-a-wordpress-site-to-a-different-server-or-url%2F&amp;t=How%20to%20move%20a%20WordPress%20site%20to%20a%20different%20Server%20or%20URL" title="Facebook"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=How%20to%20move%20a%20WordPress%20site%20to%20a%20different%20Server%20or%20URL%20-%20http%3A%2F%2Fwww.ruifeio.com%2F2009%2F08%2F08%2Fhow-to-move-a-wordpress-site-to-a-different-server-or-url%2F" title="Twitter"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F08%2F08%2Fhow-to-move-a-wordpress-site-to-a-different-server-or-url%2F&amp;t=How%20to%20move%20a%20WordPress%20site%20to%20a%20different%20Server%20or%20URL" title="MySpace"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F08%2F08%2Fhow-to-move-a-wordpress-site-to-a-different-server-or-url%2F&amp;title=How%20to%20move%20a%20WordPress%20site%20to%20a%20different%20Server%20or%20URL&amp;notes=Moving%20a%20WordPress%20site%20from%20one%20server%20to%20another%20or%20to%20a%20different%20Web%20address%20%28URL%29%20may%20seem%20a%20daunting%20task%20and%20something%20to%20stay%20away%20from.%20The%20truth%20is%20that%20it%20is%20quite%20simple%21%0D%0A%0D%0ALast%20month%20I%20was%20asked%20to%20help%20moving%20a%20WordPress%20%28WP%29%20blog%20from" title="del.icio.us"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F08%2F08%2Fhow-to-move-a-wordpress-site-to-a-different-server-or-url%2F&amp;title=How%20to%20move%20a%20WordPress%20site%20to%20a%20different%20Server%20or%20URL&amp;source=Rui+Miguel+Feio+Sharing+knowledge+with+the+world&amp;summary=Moving%20a%20WordPress%20site%20from%20one%20server%20to%20another%20or%20to%20a%20different%20Web%20address%20%28URL%29%20may%20seem%20a%20daunting%20task%20and%20something%20to%20stay%20away%20from.%20The%20truth%20is%20that%20it%20is%20quite%20simple%21%0D%0A%0D%0ALast%20month%20I%20was%20asked%20to%20help%20moving%20a%20WordPress%20%28WP%29%20blog%20from" title="LinkedIn"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F08%2F08%2Fhow-to-move-a-wordpress-site-to-a-different-server-or-url%2F&amp;title=How%20to%20move%20a%20WordPress%20site%20to%20a%20different%20Server%20or%20URL&amp;bodytext=Moving%20a%20WordPress%20site%20from%20one%20server%20to%20another%20or%20to%20a%20different%20Web%20address%20%28URL%29%20may%20seem%20a%20daunting%20task%20and%20something%20to%20stay%20away%20from.%20The%20truth%20is%20that%20it%20is%20quite%20simple%21%0D%0A%0D%0ALast%20month%20I%20was%20asked%20to%20help%20moving%20a%20WordPress%20%28WP%29%20blog%20from" title="Digg"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F08%2F08%2Fhow-to-move-a-wordpress-site-to-a-different-server-or-url%2F&amp;title=How%20to%20move%20a%20WordPress%20site%20to%20a%20different%20Server%20or%20URL" title="StumbleUpon"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F08%2F08%2Fhow-to-move-a-wordpress-site-to-a-different-server-or-url%2F&amp;title=How%20to%20move%20a%20WordPress%20site%20to%20a%20different%20Server%20or%20URL&amp;annotation=Moving%20a%20WordPress%20site%20from%20one%20server%20to%20another%20or%20to%20a%20different%20Web%20address%20%28URL%29%20may%20seem%20a%20daunting%20task%20and%20something%20to%20stay%20away%20from.%20The%20truth%20is%20that%20it%20is%20quite%20simple%21%0D%0A%0D%0ALast%20month%20I%20was%20asked%20to%20help%20moving%20a%20WordPress%20%28WP%29%20blog%20from" title="Google Bookmarks"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F08%2F08%2Fhow-to-move-a-wordpress-site-to-a-different-server-or-url%2F&amp;submitHeadline=How%20to%20move%20a%20WordPress%20site%20to%20a%20different%20Server%20or%20URL&amp;submitSummary=Moving%20a%20WordPress%20site%20from%20one%20server%20to%20another%20or%20to%20a%20different%20Web%20address%20%28URL%29%20may%20seem%20a%20daunting%20task%20and%20something%20to%20stay%20away%20from.%20The%20truth%20is%20that%20it%20is%20quite%20simple%21%0D%0A%0D%0ALast%20month%20I%20was%20asked%20to%20help%20moving%20a%20WordPress%20%28WP%29%20blog%20from&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.indianpad.com/submit.php?url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F08%2F08%2Fhow-to-move-a-wordpress-site-to-a-different-server-or-url%2F" title="IndianPad"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/indianpad.png" title="IndianPad" alt="IndianPad" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ruifeio.com/2009/08/08/how-to-move-a-wordpress-site-to-a-different-server-or-url/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to select the First row from a MySQL table</title>
		<link>http://www.ruifeio.com/2009/07/06/how-to-select-the-first-row-from-a-mysql-table/</link>
		<comments>http://www.ruifeio.com/2009/07/06/how-to-select-the-first-row-from-a-mysql-table/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 17:30:07 +0000</pubDate>
		<dc:creator>Rui Miguel Feio</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.ruifeio.com/?p=178</guid>
		<description><![CDATA[You can use the following command to get the first row from a MySQL table: SELECT * FROM table LIMIT 1 Explanation: table - table name By limiting the returns to 1 (LIMIT 1) we get the first row from the table. Example: SELECT * FROM tusers LIMIT 1]]></description>
			<content:encoded><![CDATA[<p>You can use the following command to get the first row from a MySQL table:</p>
<p>SELECT * FROM <em>table </em>LIMIT 1</p>
<p><strong>Explanation:</strong></p>
<p><em>table </em>- table name</p>
<p><em> </em></p>
<p>By limiting the returns to 1 (LIMIT 1) we get the first row from the table.</p>
<p><strong>Example:</strong></p>
<p>SELECT * FROM <em>tusers </em>LIMIT 1</p>
<div class="fullcircle-social-links" style="display: block;"></div><div style="clear: both;"></div>
<div class="sociable">

<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="mailto:?subject=How%20to%20select%20the%20First%20row%20from%20a%20MySQL%20table&amp;body=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fhow-to-select-the-first-row-from-a-mysql-table%2F" title="email"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="javascript:AddToFavorites();" title="Add to favorites"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/addtofavorites.png" title="Add to favorites" alt="Add to favorites" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fhow-to-select-the-first-row-from-a-mysql-table%2F&amp;t=How%20to%20select%20the%20First%20row%20from%20a%20MySQL%20table" title="Facebook"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=How%20to%20select%20the%20First%20row%20from%20a%20MySQL%20table%20-%20http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fhow-to-select-the-first-row-from-a-mysql-table%2F" title="Twitter"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fhow-to-select-the-first-row-from-a-mysql-table%2F&amp;t=How%20to%20select%20the%20First%20row%20from%20a%20MySQL%20table" title="MySpace"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fhow-to-select-the-first-row-from-a-mysql-table%2F&amp;title=How%20to%20select%20the%20First%20row%20from%20a%20MySQL%20table&amp;notes=You%20can%20use%20the%20following%20command%20to%20get%20the%20first%20row%20from%20a%20MySQL%20table%3A%0D%0A%0D%0ASELECT%20%2A%20FROM%20table%20LIMIT%201%0D%0A%0D%0AExplanation%3A%0D%0A%0D%0Atable%20-%20table%20name%0D%0A%0D%0A%20%0D%0A%0D%0ABy%20limiting%20the%20returns%20to%201%20%28LIMIT%201%29%20we%20get%20the%20first%20row%20from%20the%20table.%0D%0A%0D%0AExample%3A%0D%0A%0D%0ASELECT%20" title="del.icio.us"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fhow-to-select-the-first-row-from-a-mysql-table%2F&amp;title=How%20to%20select%20the%20First%20row%20from%20a%20MySQL%20table&amp;source=Rui+Miguel+Feio+Sharing+knowledge+with+the+world&amp;summary=You%20can%20use%20the%20following%20command%20to%20get%20the%20first%20row%20from%20a%20MySQL%20table%3A%0D%0A%0D%0ASELECT%20%2A%20FROM%20table%20LIMIT%201%0D%0A%0D%0AExplanation%3A%0D%0A%0D%0Atable%20-%20table%20name%0D%0A%0D%0A%20%0D%0A%0D%0ABy%20limiting%20the%20returns%20to%201%20%28LIMIT%201%29%20we%20get%20the%20first%20row%20from%20the%20table.%0D%0A%0D%0AExample%3A%0D%0A%0D%0ASELECT%20" title="LinkedIn"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fhow-to-select-the-first-row-from-a-mysql-table%2F&amp;title=How%20to%20select%20the%20First%20row%20from%20a%20MySQL%20table&amp;bodytext=You%20can%20use%20the%20following%20command%20to%20get%20the%20first%20row%20from%20a%20MySQL%20table%3A%0D%0A%0D%0ASELECT%20%2A%20FROM%20table%20LIMIT%201%0D%0A%0D%0AExplanation%3A%0D%0A%0D%0Atable%20-%20table%20name%0D%0A%0D%0A%20%0D%0A%0D%0ABy%20limiting%20the%20returns%20to%201%20%28LIMIT%201%29%20we%20get%20the%20first%20row%20from%20the%20table.%0D%0A%0D%0AExample%3A%0D%0A%0D%0ASELECT%20" title="Digg"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fhow-to-select-the-first-row-from-a-mysql-table%2F&amp;title=How%20to%20select%20the%20First%20row%20from%20a%20MySQL%20table" title="StumbleUpon"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fhow-to-select-the-first-row-from-a-mysql-table%2F&amp;title=How%20to%20select%20the%20First%20row%20from%20a%20MySQL%20table&amp;annotation=You%20can%20use%20the%20following%20command%20to%20get%20the%20first%20row%20from%20a%20MySQL%20table%3A%0D%0A%0D%0ASELECT%20%2A%20FROM%20table%20LIMIT%201%0D%0A%0D%0AExplanation%3A%0D%0A%0D%0Atable%20-%20table%20name%0D%0A%0D%0A%20%0D%0A%0D%0ABy%20limiting%20the%20returns%20to%201%20%28LIMIT%201%29%20we%20get%20the%20first%20row%20from%20the%20table.%0D%0A%0D%0AExample%3A%0D%0A%0D%0ASELECT%20" title="Google Bookmarks"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fhow-to-select-the-first-row-from-a-mysql-table%2F&amp;submitHeadline=How%20to%20select%20the%20First%20row%20from%20a%20MySQL%20table&amp;submitSummary=You%20can%20use%20the%20following%20command%20to%20get%20the%20first%20row%20from%20a%20MySQL%20table%3A%0D%0A%0D%0ASELECT%20%2A%20FROM%20table%20LIMIT%201%0D%0A%0D%0AExplanation%3A%0D%0A%0D%0Atable%20-%20table%20name%0D%0A%0D%0A%20%0D%0A%0D%0ABy%20limiting%20the%20returns%20to%201%20%28LIMIT%201%29%20we%20get%20the%20first%20row%20from%20the%20table.%0D%0A%0D%0AExample%3A%0D%0A%0D%0ASELECT%20&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.indianpad.com/submit.php?url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fhow-to-select-the-first-row-from-a-mysql-table%2F" title="IndianPad"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/indianpad.png" title="IndianPad" alt="IndianPad" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ruifeio.com/2009/07/06/how-to-select-the-first-row-from-a-mysql-table/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to select the Last row from a MySQL table</title>
		<link>http://www.ruifeio.com/2009/07/06/how-to-select-the-last-row-from-a-mysql-table/</link>
		<comments>http://www.ruifeio.com/2009/07/06/how-to-select-the-last-row-from-a-mysql-table/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 17:24:44 +0000</pubDate>
		<dc:creator>Rui Miguel Feio</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.ruifeio.com/?p=174</guid>
		<description><![CDATA[You can use the following command to get the last row from a MySQL table: SELECT * FROM table ORDER BY field DESC LIMIT 1 Explanation: table - table name field - table field This command orders the table by DESCENDING order and limits the number of rows returned to 1. Since DESCENDING reverses the [...]]]></description>
			<content:encoded><![CDATA[<p>You can use the following command to get the last row from a MySQL table:</p>
<p>SELECT * FROM <em>table </em>ORDER BY <em>field </em>DESC LIMIT 1</p>
<p><strong>Explanation:</strong></p>
<p><em>table </em>- table name</p>
<p><em>field </em>- table field</p>
<p>This command orders the table by DESCENDING order and limits the number of rows returned to 1. Since DESCENDING reverses the normal table order, we get its last row.</p>
<p><strong>Example:</strong></p>
<p>SELECT * FROM <em>tusers </em>ORDER BY <em>user_id</em> DESC LIMIT 1</p>
<div class="fullcircle-social-links" style="display: block;"></div><div style="clear: both;"></div>
<div class="sociable">

<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="mailto:?subject=How%20to%20select%20the%20Last%20row%20from%20a%20MySQL%20table&amp;body=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fhow-to-select-the-last-row-from-a-mysql-table%2F" title="email"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="javascript:AddToFavorites();" title="Add to favorites"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/addtofavorites.png" title="Add to favorites" alt="Add to favorites" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fhow-to-select-the-last-row-from-a-mysql-table%2F&amp;t=How%20to%20select%20the%20Last%20row%20from%20a%20MySQL%20table" title="Facebook"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=How%20to%20select%20the%20Last%20row%20from%20a%20MySQL%20table%20-%20http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fhow-to-select-the-last-row-from-a-mysql-table%2F" title="Twitter"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fhow-to-select-the-last-row-from-a-mysql-table%2F&amp;t=How%20to%20select%20the%20Last%20row%20from%20a%20MySQL%20table" title="MySpace"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fhow-to-select-the-last-row-from-a-mysql-table%2F&amp;title=How%20to%20select%20the%20Last%20row%20from%20a%20MySQL%20table&amp;notes=You%20can%20use%20the%20following%20command%20to%20get%20the%20last%20row%20from%20a%20MySQL%20table%3A%0D%0A%0D%0ASELECT%20%2A%20FROM%20table%20ORDER%20BY%20field%20DESC%20LIMIT%201%0D%0A%0D%0AExplanation%3A%0D%0A%0D%0Atable%20-%20table%20name%0D%0A%0D%0Afield%20-%20table%20field%0D%0A%0D%0AThis%20command%20orders%20the%20table%20by%20DESCENDING%20order%20and%20limits%20" title="del.icio.us"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fhow-to-select-the-last-row-from-a-mysql-table%2F&amp;title=How%20to%20select%20the%20Last%20row%20from%20a%20MySQL%20table&amp;source=Rui+Miguel+Feio+Sharing+knowledge+with+the+world&amp;summary=You%20can%20use%20the%20following%20command%20to%20get%20the%20last%20row%20from%20a%20MySQL%20table%3A%0D%0A%0D%0ASELECT%20%2A%20FROM%20table%20ORDER%20BY%20field%20DESC%20LIMIT%201%0D%0A%0D%0AExplanation%3A%0D%0A%0D%0Atable%20-%20table%20name%0D%0A%0D%0Afield%20-%20table%20field%0D%0A%0D%0AThis%20command%20orders%20the%20table%20by%20DESCENDING%20order%20and%20limits%20" title="LinkedIn"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fhow-to-select-the-last-row-from-a-mysql-table%2F&amp;title=How%20to%20select%20the%20Last%20row%20from%20a%20MySQL%20table&amp;bodytext=You%20can%20use%20the%20following%20command%20to%20get%20the%20last%20row%20from%20a%20MySQL%20table%3A%0D%0A%0D%0ASELECT%20%2A%20FROM%20table%20ORDER%20BY%20field%20DESC%20LIMIT%201%0D%0A%0D%0AExplanation%3A%0D%0A%0D%0Atable%20-%20table%20name%0D%0A%0D%0Afield%20-%20table%20field%0D%0A%0D%0AThis%20command%20orders%20the%20table%20by%20DESCENDING%20order%20and%20limits%20" title="Digg"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fhow-to-select-the-last-row-from-a-mysql-table%2F&amp;title=How%20to%20select%20the%20Last%20row%20from%20a%20MySQL%20table" title="StumbleUpon"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fhow-to-select-the-last-row-from-a-mysql-table%2F&amp;title=How%20to%20select%20the%20Last%20row%20from%20a%20MySQL%20table&amp;annotation=You%20can%20use%20the%20following%20command%20to%20get%20the%20last%20row%20from%20a%20MySQL%20table%3A%0D%0A%0D%0ASELECT%20%2A%20FROM%20table%20ORDER%20BY%20field%20DESC%20LIMIT%201%0D%0A%0D%0AExplanation%3A%0D%0A%0D%0Atable%20-%20table%20name%0D%0A%0D%0Afield%20-%20table%20field%0D%0A%0D%0AThis%20command%20orders%20the%20table%20by%20DESCENDING%20order%20and%20limits%20" title="Google Bookmarks"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fhow-to-select-the-last-row-from-a-mysql-table%2F&amp;submitHeadline=How%20to%20select%20the%20Last%20row%20from%20a%20MySQL%20table&amp;submitSummary=You%20can%20use%20the%20following%20command%20to%20get%20the%20last%20row%20from%20a%20MySQL%20table%3A%0D%0A%0D%0ASELECT%20%2A%20FROM%20table%20ORDER%20BY%20field%20DESC%20LIMIT%201%0D%0A%0D%0AExplanation%3A%0D%0A%0D%0Atable%20-%20table%20name%0D%0A%0D%0Afield%20-%20table%20field%0D%0A%0D%0AThis%20command%20orders%20the%20table%20by%20DESCENDING%20order%20and%20limits%20&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.indianpad.com/submit.php?url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fhow-to-select-the-last-row-from-a-mysql-table%2F" title="IndianPad"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/indianpad.png" title="IndianPad" alt="IndianPad" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ruifeio.com/2009/07/06/how-to-select-the-last-row-from-a-mysql-table/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Select random rows from a MySQL table</title>
		<link>http://www.ruifeio.com/2009/07/06/select-random-rows-from-mysql-table/</link>
		<comments>http://www.ruifeio.com/2009/07/06/select-random-rows-from-mysql-table/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 17:14:41 +0000</pubDate>
		<dc:creator>Rui Miguel Feio</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.ruifeio.com/?p=168</guid>
		<description><![CDATA[If you ever come across the need of randomly select rows from a MySQL table: SELECT * FROM table WHERE field1 = value ORDER BY RAND() LIMIT x Explanation: table - table name field1 - table field value - value you want field1 to be x &#8211; number of rows to return Example: SELECT * [...]]]></description>
			<content:encoded><![CDATA[<p>If you ever come across the need of randomly select rows from a MySQL table:</p>
<p>SELECT * FROM <em>table </em>WHERE <em>field1 </em>= <em>value </em>ORDER BY RAND() LIMIT <em>x</em></p>
<p><strong>Explanation:</strong></p>
<p><em>table </em>- table name</p>
<p><em>field1 </em>- table field</p>
<p><em>value </em>- value you want field1 to be</p>
<p><em>x</em> &#8211; number of rows to return</p>
<p><strong>Example:</strong></p>
<p>SELECT * FROM <em>tusers </em>WHERE <em>active_user </em>= &#8216;<em>Yes</em>&#8216; ORDER BY RAND() LIMIT <em>10</em></p>
<p>This command returns 10 random rows of active users from table tusers.</p>
<div class="fullcircle-social-links" style="display: block;"></div><div style="clear: both;"></div>
<div class="sociable">

<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="mailto:?subject=Select%20random%20rows%20from%20a%20MySQL%20table&amp;body=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fselect-random-rows-from-mysql-table%2F" title="email"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="javascript:AddToFavorites();" title="Add to favorites"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/addtofavorites.png" title="Add to favorites" alt="Add to favorites" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fselect-random-rows-from-mysql-table%2F&amp;t=Select%20random%20rows%20from%20a%20MySQL%20table" title="Facebook"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Select%20random%20rows%20from%20a%20MySQL%20table%20-%20http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fselect-random-rows-from-mysql-table%2F" title="Twitter"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fselect-random-rows-from-mysql-table%2F&amp;t=Select%20random%20rows%20from%20a%20MySQL%20table" title="MySpace"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fselect-random-rows-from-mysql-table%2F&amp;title=Select%20random%20rows%20from%20a%20MySQL%20table&amp;notes=If%20you%20ever%20come%20across%20the%20need%20of%20randomly%20select%20rows%20from%20a%20MySQL%20table%3A%0D%0A%0D%0ASELECT%20%2A%20FROM%20table%20WHERE%20field1%20%3D%20value%20ORDER%20BY%20RAND%28%29%20LIMIT%20x%0D%0A%0D%0AExplanation%3A%0D%0A%0D%0Atable%20-%20table%20name%0D%0A%0D%0Afield1%20-%20table%20field%0D%0A%0D%0Avalue%20-%20value%20you%20want%20field1%20to%20be%0D%0A%0D%0Ax" title="del.icio.us"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fselect-random-rows-from-mysql-table%2F&amp;title=Select%20random%20rows%20from%20a%20MySQL%20table&amp;source=Rui+Miguel+Feio+Sharing+knowledge+with+the+world&amp;summary=If%20you%20ever%20come%20across%20the%20need%20of%20randomly%20select%20rows%20from%20a%20MySQL%20table%3A%0D%0A%0D%0ASELECT%20%2A%20FROM%20table%20WHERE%20field1%20%3D%20value%20ORDER%20BY%20RAND%28%29%20LIMIT%20x%0D%0A%0D%0AExplanation%3A%0D%0A%0D%0Atable%20-%20table%20name%0D%0A%0D%0Afield1%20-%20table%20field%0D%0A%0D%0Avalue%20-%20value%20you%20want%20field1%20to%20be%0D%0A%0D%0Ax" title="LinkedIn"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fselect-random-rows-from-mysql-table%2F&amp;title=Select%20random%20rows%20from%20a%20MySQL%20table&amp;bodytext=If%20you%20ever%20come%20across%20the%20need%20of%20randomly%20select%20rows%20from%20a%20MySQL%20table%3A%0D%0A%0D%0ASELECT%20%2A%20FROM%20table%20WHERE%20field1%20%3D%20value%20ORDER%20BY%20RAND%28%29%20LIMIT%20x%0D%0A%0D%0AExplanation%3A%0D%0A%0D%0Atable%20-%20table%20name%0D%0A%0D%0Afield1%20-%20table%20field%0D%0A%0D%0Avalue%20-%20value%20you%20want%20field1%20to%20be%0D%0A%0D%0Ax" title="Digg"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fselect-random-rows-from-mysql-table%2F&amp;title=Select%20random%20rows%20from%20a%20MySQL%20table" title="StumbleUpon"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fselect-random-rows-from-mysql-table%2F&amp;title=Select%20random%20rows%20from%20a%20MySQL%20table&amp;annotation=If%20you%20ever%20come%20across%20the%20need%20of%20randomly%20select%20rows%20from%20a%20MySQL%20table%3A%0D%0A%0D%0ASELECT%20%2A%20FROM%20table%20WHERE%20field1%20%3D%20value%20ORDER%20BY%20RAND%28%29%20LIMIT%20x%0D%0A%0D%0AExplanation%3A%0D%0A%0D%0Atable%20-%20table%20name%0D%0A%0D%0Afield1%20-%20table%20field%0D%0A%0D%0Avalue%20-%20value%20you%20want%20field1%20to%20be%0D%0A%0D%0Ax" title="Google Bookmarks"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fselect-random-rows-from-mysql-table%2F&amp;submitHeadline=Select%20random%20rows%20from%20a%20MySQL%20table&amp;submitSummary=If%20you%20ever%20come%20across%20the%20need%20of%20randomly%20select%20rows%20from%20a%20MySQL%20table%3A%0D%0A%0D%0ASELECT%20%2A%20FROM%20table%20WHERE%20field1%20%3D%20value%20ORDER%20BY%20RAND%28%29%20LIMIT%20x%0D%0A%0D%0AExplanation%3A%0D%0A%0D%0Atable%20-%20table%20name%0D%0A%0D%0Afield1%20-%20table%20field%0D%0A%0D%0Avalue%20-%20value%20you%20want%20field1%20to%20be%0D%0A%0D%0Ax&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.indianpad.com/submit.php?url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F06%2Fselect-random-rows-from-mysql-table%2F" title="IndianPad"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/indianpad.png" title="IndianPad" alt="IndianPad" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ruifeio.com/2009/07/06/select-random-rows-from-mysql-table/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to validate an email address format</title>
		<link>http://www.ruifeio.com/2009/07/02/how-to-validate-an-email-address-format/</link>
		<comments>http://www.ruifeio.com/2009/07/02/how-to-validate-an-email-address-format/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 10:21:10 +0000</pubDate>
		<dc:creator>Rui Miguel Feio</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.ruifeio.com/?p=85</guid>
		<description><![CDATA[There are several ways of validating an email address format. Normally, I do it the following way: 1. I first define the regular expression for the email format: define (&#8220;FORMAT&#8221;,&#8221;^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$&#8221;); 2. To validate the email address provided is correct: if ( !eregi (FORMAT, $email)) echo &#8220;The email provided has an invalid format&#8221;; Regular expressions can [...]]]></description>
			<content:encoded><![CDATA[<p>There are several ways of validating an email address format.</p>
<p>Normally, I do it the following way:</p>
<p><strong>1. I first define the regular expression for the email format:</strong></p>
<p>define (&#8220;FORMAT&#8221;,&#8221;^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$&#8221;);</p>
<p><strong>2. To validate the email address provided is correct:</strong></p>
<p>if ( !eregi (FORMAT, $email)) echo &#8220;The email provided has an invalid format&#8221;;</p>
<hr />Regular expressions can be a pain to understand and if it&#8217;s hard for you then I would recommend you read &#8220;<a title="Check out book - Sams Teach Yourself Regular Expressions in 10 minutes" href="http://www.ruifeio.com/sams-teach-yourself-regular-expressions-10-minutes-book" onclick="return TrackClick('http%3A%2F%2Fwww.ruifeio.com%2Fsams-teach-yourself-regular-expressions-10-minutes-book','Check+out+book+-+Sams+Teach+Yourself+Regular+Expressions+in+10+minutes')" target="_blank">Sams Teach Yourself Regular Expressions in 10 Minutes</a>&#8221; from Ben Forta.</p>
<p>If however you are simply interested in some practical examples that you could use then I recommend &#8220;<a title="Check out book - Regular Expressions Cookbook" href="http://www.ruifeio.com/regular-expressions-cookbook-book" onclick="return TrackClick('http%3A%2F%2Fwww.ruifeio.com%2Fregular-expressions-cookbook-book','Check+out+book+-+Regular+Expressions+Cookbook')" target="_blank">Regular Expressions Cookbook</a>&#8221; from Jan Goyvaerts and Steven Levithan.</p>
<hr />
<div class="fullcircle-social-links" style="display: block;"></div><div style="clear: both;"></div>
<div class="sociable">

<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="mailto:?subject=How%20to%20validate%20an%20email%20address%20format&amp;body=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F02%2Fhow-to-validate-an-email-address-format%2F" title="email"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="javascript:AddToFavorites();" title="Add to favorites"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/addtofavorites.png" title="Add to favorites" alt="Add to favorites" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F02%2Fhow-to-validate-an-email-address-format%2F&amp;t=How%20to%20validate%20an%20email%20address%20format" title="Facebook"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=How%20to%20validate%20an%20email%20address%20format%20-%20http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F02%2Fhow-to-validate-an-email-address-format%2F" title="Twitter"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F02%2Fhow-to-validate-an-email-address-format%2F&amp;t=How%20to%20validate%20an%20email%20address%20format" title="MySpace"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F02%2Fhow-to-validate-an-email-address-format%2F&amp;title=How%20to%20validate%20an%20email%20address%20format&amp;notes=There%20are%20several%20ways%20of%20validating%20an%20email%20address%20format.%0D%0A%0D%0ANormally%2C%20I%20do%20it%20the%20following%20way%3A%0D%0A%0D%0A1.%20I%20first%20define%20the%20regular%20expression%20for%20the%20email%20format%3A%0D%0A%0D%0Adefine%20%28%22FORMAT%22%2C%22%5E%5B_a-z0-9-%5D%2B%28%5C.%5B_a-z0-9-%5D%2B%29%2A%40%5Ba-z0-9-%5D%2B%28%5C.%5Ba-z0-9-%5D%2B%29%2A%28%5C.%5Ba-z" title="del.icio.us"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F02%2Fhow-to-validate-an-email-address-format%2F&amp;title=How%20to%20validate%20an%20email%20address%20format&amp;source=Rui+Miguel+Feio+Sharing+knowledge+with+the+world&amp;summary=There%20are%20several%20ways%20of%20validating%20an%20email%20address%20format.%0D%0A%0D%0ANormally%2C%20I%20do%20it%20the%20following%20way%3A%0D%0A%0D%0A1.%20I%20first%20define%20the%20regular%20expression%20for%20the%20email%20format%3A%0D%0A%0D%0Adefine%20%28%22FORMAT%22%2C%22%5E%5B_a-z0-9-%5D%2B%28%5C.%5B_a-z0-9-%5D%2B%29%2A%40%5Ba-z0-9-%5D%2B%28%5C.%5Ba-z0-9-%5D%2B%29%2A%28%5C.%5Ba-z" title="LinkedIn"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F02%2Fhow-to-validate-an-email-address-format%2F&amp;title=How%20to%20validate%20an%20email%20address%20format&amp;bodytext=There%20are%20several%20ways%20of%20validating%20an%20email%20address%20format.%0D%0A%0D%0ANormally%2C%20I%20do%20it%20the%20following%20way%3A%0D%0A%0D%0A1.%20I%20first%20define%20the%20regular%20expression%20for%20the%20email%20format%3A%0D%0A%0D%0Adefine%20%28%22FORMAT%22%2C%22%5E%5B_a-z0-9-%5D%2B%28%5C.%5B_a-z0-9-%5D%2B%29%2A%40%5Ba-z0-9-%5D%2B%28%5C.%5Ba-z0-9-%5D%2B%29%2A%28%5C.%5Ba-z" title="Digg"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F02%2Fhow-to-validate-an-email-address-format%2F&amp;title=How%20to%20validate%20an%20email%20address%20format" title="StumbleUpon"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F02%2Fhow-to-validate-an-email-address-format%2F&amp;title=How%20to%20validate%20an%20email%20address%20format&amp;annotation=There%20are%20several%20ways%20of%20validating%20an%20email%20address%20format.%0D%0A%0D%0ANormally%2C%20I%20do%20it%20the%20following%20way%3A%0D%0A%0D%0A1.%20I%20first%20define%20the%20regular%20expression%20for%20the%20email%20format%3A%0D%0A%0D%0Adefine%20%28%22FORMAT%22%2C%22%5E%5B_a-z0-9-%5D%2B%28%5C.%5B_a-z0-9-%5D%2B%29%2A%40%5Ba-z0-9-%5D%2B%28%5C.%5Ba-z0-9-%5D%2B%29%2A%28%5C.%5Ba-z" title="Google Bookmarks"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F02%2Fhow-to-validate-an-email-address-format%2F&amp;submitHeadline=How%20to%20validate%20an%20email%20address%20format&amp;submitSummary=There%20are%20several%20ways%20of%20validating%20an%20email%20address%20format.%0D%0A%0D%0ANormally%2C%20I%20do%20it%20the%20following%20way%3A%0D%0A%0D%0A1.%20I%20first%20define%20the%20regular%20expression%20for%20the%20email%20format%3A%0D%0A%0D%0Adefine%20%28%22FORMAT%22%2C%22%5E%5B_a-z0-9-%5D%2B%28%5C.%5B_a-z0-9-%5D%2B%29%2A%40%5Ba-z0-9-%5D%2B%28%5C.%5Ba-z0-9-%5D%2B%29%2A%28%5C.%5Ba-z&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.indianpad.com/submit.php?url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F02%2Fhow-to-validate-an-email-address-format%2F" title="IndianPad"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/indianpad.png" title="IndianPad" alt="IndianPad" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ruifeio.com/2009/07/02/how-to-validate-an-email-address-format/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP security considerations</title>
		<link>http://www.ruifeio.com/2009/07/01/php-security-considerations/</link>
		<comments>http://www.ruifeio.com/2009/07/01/php-security-considerations/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 22:11:09 +0000</pubDate>
		<dc:creator>Rui Miguel Feio</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.ruifeio.com/?p=71</guid>
		<description><![CDATA[When developing a script wether if it&#8217;s in PHP or any other language you should always consider the security aspect. I&#8217;m sure the last thing you want is to get your script (and ultimately your data) hacked. To make sure this does not happen there are a few steps you should pay attention at: Turn [...]]]></description>
			<content:encoded><![CDATA[<p>When developing a script wether if it&#8217;s in PHP or any other language you should always consider the security aspect. I&#8217;m sure the last thing you want is to get your script (and ultimately your data) hacked.</p>
<p>To make sure this does not happen there are a few steps you should pay attention at:</p>
<ol>
<li>Turn OFF the <em>register_globals</em> option</li>
<li>Always declare variables in advance</li>
<li>Check input type, length and format</li>
<li>Use <em>mysql_real_escape_string()</em> before passing values to a MySQL query</li>
<li>Use <em>htmlentities() </em>to convert characters to html entities before passing values to a MySQL query</li>
<li>Turn OFF the error reporting and display</li>
</ol>
<p><strong>Here are some ways on how to achieve these:</strong></p>
<p><strong>1. To turn OFF the <em>register_global</em> option:</strong></p>
<p>Edit your <em>php.ini</em> and turn it OFF or if you don&#8217;t have access to it add the following to the <em>.htaccess</em> file in your server:</p>
<p><em>php_flag register_globals 0</em></p>
<p><strong>2. Always declare variables in advance:</strong></p>
<p>Define default values to all the variables you&#8217;re going to use in the beginning of your script.</p>
<p><strong>3. Check input type, length and format:</strong></p>
<p>Always make sure that the value of the variable is exactly what the script should expect.</p>
<p><span style="text-decoration: underline;">Checking type (example):</span></p>
<p>if ($settype($var, &#8216;integer&#8217;)) exit(&#8220;$var is an invalid value&#8221;);</p>
<p><span style="text-decoration: underline;">Checking length (example):</span></p>
<p>if(strlen($var) &gt; 20) exit (&#8220;$var has to have a maximum of 20 characters&#8221;);</p>
<p><span style="text-decoration: underline;">Checking format (example):</span></p>
<p>$format = &#8220;^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$&#8221;;</p>
<p>if(!eregi($format, $email)) exit(&#8220;$email is not a valid email address&#8221;);</p>
<p><strong>4. Use <em>mysql_real_escape_string()</em> before passing values to a MySQL query</strong></p>
<p>Escape the content of your variables before passing them to a MySQL Query to sanitize the values passed to your data base:</p>
<p>$escaped = mysql_real_escape_string($var);</p>
<p>$action = &#8220;SELECT * FROM table WHERE field = &#8216;$escaped&#8217; &#8220;;</p>
<p><strong>5. Use htmlentities() to convert characters to html entities before passing values to a MySQL query</strong></p>
<p>Another way to sanitize the values passed to your data base is by using the <em>htmlentities() </em>function. This converts special characters to their corresponding HTML code:</p>
<p>$convert= htmlentities($var);</p>
<p>$action = &#8220;SELECT * FROM table WHERE field = &#8216;$convert&#8217; &#8220;;</p>
<p><strong>6.  Turn OFF the error reporting and display</strong></p>
<p>You should never allow the system to show the error messages in your live production server because these messages can provide precious information about your system.</p>
<p>You can either set both <em>error_reporting</em> and <em>display_errors</em> to 0 <em>in php.ini</em> or when you execute the scripts with <em>error_reporting(0)</em> and <em>display_errors(0)</em>.</p>
<hr />If you would like to know more about PHP Security I recommend the book &#8220;<a title="Check out book - Pro PHP Security" href="http://www.ruifeio.com/pro-php-security-book" onclick="return TrackClick('http%3A%2F%2Fwww.ruifeio.com%2Fpro-php-security-book','Check+out+book+-+Pro+PHP+Security')" target="_blank">Pro PHP Security</a>&#8221; from Chris Snyder.</p>
<hr />
<div class="fullcircle-social-links" style="display: block;"></div><div style="clear: both;"></div>
<div class="sociable">

<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="mailto:?subject=PHP%20security%20considerations&amp;body=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F01%2Fphp-security-considerations%2F" title="email"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="javascript:AddToFavorites();" title="Add to favorites"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/addtofavorites.png" title="Add to favorites" alt="Add to favorites" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F01%2Fphp-security-considerations%2F&amp;t=PHP%20security%20considerations" title="Facebook"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=PHP%20security%20considerations%20-%20http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F01%2Fphp-security-considerations%2F" title="Twitter"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F01%2Fphp-security-considerations%2F&amp;t=PHP%20security%20considerations" title="MySpace"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F01%2Fphp-security-considerations%2F&amp;title=PHP%20security%20considerations&amp;notes=When%20developing%20a%20script%20wether%20if%20it%27s%20in%20PHP%20or%20any%20other%20language%20you%20should%20always%20consider%20the%20security%20aspect.%20I%27m%20sure%20the%20last%20thing%20you%20want%20is%20to%20get%20your%20script%20%28and%20ultimately%20your%20data%29%20hacked.%0D%0A%0D%0ATo%20make%20sure%20this%20does%20not%20happen%20there%20" title="del.icio.us"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F01%2Fphp-security-considerations%2F&amp;title=PHP%20security%20considerations&amp;source=Rui+Miguel+Feio+Sharing+knowledge+with+the+world&amp;summary=When%20developing%20a%20script%20wether%20if%20it%27s%20in%20PHP%20or%20any%20other%20language%20you%20should%20always%20consider%20the%20security%20aspect.%20I%27m%20sure%20the%20last%20thing%20you%20want%20is%20to%20get%20your%20script%20%28and%20ultimately%20your%20data%29%20hacked.%0D%0A%0D%0ATo%20make%20sure%20this%20does%20not%20happen%20there%20" title="LinkedIn"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F01%2Fphp-security-considerations%2F&amp;title=PHP%20security%20considerations&amp;bodytext=When%20developing%20a%20script%20wether%20if%20it%27s%20in%20PHP%20or%20any%20other%20language%20you%20should%20always%20consider%20the%20security%20aspect.%20I%27m%20sure%20the%20last%20thing%20you%20want%20is%20to%20get%20your%20script%20%28and%20ultimately%20your%20data%29%20hacked.%0D%0A%0D%0ATo%20make%20sure%20this%20does%20not%20happen%20there%20" title="Digg"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F01%2Fphp-security-considerations%2F&amp;title=PHP%20security%20considerations" title="StumbleUpon"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F01%2Fphp-security-considerations%2F&amp;title=PHP%20security%20considerations&amp;annotation=When%20developing%20a%20script%20wether%20if%20it%27s%20in%20PHP%20or%20any%20other%20language%20you%20should%20always%20consider%20the%20security%20aspect.%20I%27m%20sure%20the%20last%20thing%20you%20want%20is%20to%20get%20your%20script%20%28and%20ultimately%20your%20data%29%20hacked.%0D%0A%0D%0ATo%20make%20sure%20this%20does%20not%20happen%20there%20" title="Google Bookmarks"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F01%2Fphp-security-considerations%2F&amp;submitHeadline=PHP%20security%20considerations&amp;submitSummary=When%20developing%20a%20script%20wether%20if%20it%27s%20in%20PHP%20or%20any%20other%20language%20you%20should%20always%20consider%20the%20security%20aspect.%20I%27m%20sure%20the%20last%20thing%20you%20want%20is%20to%20get%20your%20script%20%28and%20ultimately%20your%20data%29%20hacked.%0D%0A%0D%0ATo%20make%20sure%20this%20does%20not%20happen%20there%20&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.indianpad.com/submit.php?url=http%3A%2F%2Fwww.ruifeio.com%2F2009%2F07%2F01%2Fphp-security-considerations%2F" title="IndianPad"><img src="http://www.ruifeio.com/wp-content/plugins/sociable/images/indianpad.png" title="IndianPad" alt="IndianPad" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ruifeio.com/2009/07/01/php-security-considerations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
