<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Tips for Programming and PHP</title>
	<atom:link href="http://chris.pirillo.com/tips-for-programming-and-php/feed/" rel="self" type="application/rss+xml" />
	<link>http://chris.pirillo.com/tips-for-programming-and-php/</link>
	<description>News and Reviews! Geek, Internet Entrepreneur, Hardware Addict, Software Junkie, Book Author, Once TV Show Host, Technology Enthusiast, Shameless Self-Promoter, Tech Conference Coordinator, Early Adopter, Idea Evangelist, Tech Support Blogger, Bootstrapper, Media Personality, Technology Consultant, Thicker Quicker Picker Upper.</description>
	<lastBuildDate>Wed, 15 Feb 2012 04:06:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: Anonymous</title>
		<link>http://chris.pirillo.com/tips-for-programming-and-php/#comment-776939</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Tue, 21 Jun 2011 05:12:00 +0000</pubDate>
		<guid isPermaLink="false">http://chris.pirillo.com/?p=13591#comment-776939</guid>
		<description>Great tips are posted here. Really tips are so useful for PHP programmer who are making website. PHP is server side language so it not an easy to learn it. This is great site that will guiding like this to programmer by their blog.  
&lt;a href=&quot;http://www.findyourartschool.com/ep/graphic-design-schools.php&quot; rel=&quot;nofollow&quot;&gt;Graphic Design Schools&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>Great tips are posted here. Really tips are so useful for PHP programmer who are making website. PHP is server side language so it not an easy to learn it. This is great site that will guiding like this to programmer by their blog. <br />
<a href="http://www.findyourartschool.com/ep/graphic-design-schools.php" rel="nofollow">Graphic Design Schools</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: php programer</title>
		<link>http://chris.pirillo.com/tips-for-programming-and-php/#comment-775382</link>
		<dc:creator>php programer</dc:creator>
		<pubDate>Mon, 25 Apr 2011 17:22:00 +0000</pubDate>
		<guid isPermaLink="false">http://chris.pirillo.com/?p=13591#comment-775382</guid>
		<description>This is very informative, thank you for posting the tutorial!
It’s nice to find a good article. I really enjoy lots of the blog posts on your web site
</description>
		<content:encoded><![CDATA[<p>This is very informative, thank you for posting the tutorial!<br />
It’s nice to find a good article. I really enjoy lots of the blog posts on your web site</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Angela Hayden</title>
		<link>http://chris.pirillo.com/tips-for-programming-and-php/#comment-718919</link>
		<dc:creator>Angela Hayden</dc:creator>
		<pubDate>Wed, 05 Aug 2009 17:05:09 +0000</pubDate>
		<guid isPermaLink="false">http://chris.pirillo.com/?p=13591#comment-718919</guid>
		<description>Where&#039;s the &quot;For Dummies&quot; section. I&#039;d love a &quot;one click install everything button&quot;!</description>
		<content:encoded><![CDATA[<p>Where&#8217;s the &#8220;For Dummies&#8221; section. I&#8217;d love a &#8220;one click install everything button&#8221;!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Austin</title>
		<link>http://chris.pirillo.com/tips-for-programming-and-php/#comment-716412</link>
		<dc:creator>Austin</dc:creator>
		<pubDate>Thu, 02 Jul 2009 10:19:10 +0000</pubDate>
		<guid isPermaLink="false">http://chris.pirillo.com/?p=13591#comment-716412</guid>
		<description>Just take it step-by-step. Just start from scratch with &quot;Hello World!&quot; or take a simple script and mess around with it. Examine the code and look-up each one. Think of why they put it there, why should it be there, why would it be there, and why is it there.</description>
		<content:encoded><![CDATA[<p>Just take it step-by-step. Just start from scratch with &#8220;Hello World!&#8221; or take a simple script and mess around with it. Examine the code and look-up each one. Think of why they put it there, why should it be there, why would it be there, and why is it there.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cal Evans</title>
		<link>http://chris.pirillo.com/tips-for-programming-and-php/#comment-716410</link>
		<dc:creator>Cal Evans</dc:creator>
		<pubDate>Thu, 02 Jul 2009 08:37:25 +0000</pubDate>
		<guid isPermaLink="false">http://chris.pirillo.com/?p=13591#comment-716410</guid>
		<description>Jim,

Spot on on all of your corrections. I write PHP advice and tutorials for web sites as part of my day job and know all too well that advice posted at a reputable site like this will live on in code for years, whether it&#039;s good advice or not.

Thanks for taking the time to post corrections

=C=</description>
		<content:encoded><![CDATA[<p>Jim,</p>
<p>Spot on on all of your corrections. I write PHP advice and tutorials for web sites as part of my day job and know all too well that advice posted at a reputable site like this will live on in code for years, whether it&#8217;s good advice or not.</p>
<p>Thanks for taking the time to post corrections</p>
<p>=C=</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Savage</title>
		<link>http://chris.pirillo.com/tips-for-programming-and-php/#comment-716364</link>
		<dc:creator>James Savage</dc:creator>
		<pubDate>Wed, 01 Jul 2009 14:49:23 +0000</pubDate>
		<guid isPermaLink="false">http://chris.pirillo.com/?p=13591#comment-716364</guid>
		<description>Another good tip is always look around when debugging, if you have an error on line 8, be sure you ended line 7 with a ; and user an editor with bracket sense to check that you close all () and {}.</description>
		<content:encoded><![CDATA[<p>Another good tip is always look around when debugging, if you have an error on line 8, be sure you ended line 7 with a ; and user an editor with bracket sense to check that you close all () and {}.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jim Rubenstein</title>
		<link>http://chris.pirillo.com/tips-for-programming-and-php/#comment-716308</link>
		<dc:creator>Jim Rubenstein</dc:creator>
		<pubDate>Wed, 01 Jul 2009 03:26:52 +0000</pubDate>
		<guid isPermaLink="false">http://chris.pirillo.com/?p=13591#comment-716308</guid>
		<description>I was surprised to see a post like this on your site Chris..knowing that you&#039;re not exactly of programmer background - having said so yourself.  I&#039;m a full time developer, and while most of these tips are very basic, there are two that I&#039;d like to &quot;add more&quot; to.

Firstly, as for detecting if PHP is set up correctly..use the php -i command from the command line, or phpinfo() function on a php file loaded through your web server.  This will allow you (the setter-upper) to tell if all the modules you expected to be loaded, are loaded properly.  For example, when you load the MySQL extension into php, there will be a section of `php -i` or phpinfo() labeled &quot;mysql&quot; and will show some default server variables for the module, letting you know that the MySQL client library is loaded and available to php.

Secondly, in reference to using &quot;addslashes&quot; and &quot;magic_quotes_gpc.&quot;  DON&#039;T!  The &quot;addslashes&quot; function is *absolutely not suitable* for sanitizing database input.  It does not do anything more than add backslashes before apostrophes in a string, and does not take into account the databases&#039; character set collation.  As for the &quot;magic_quotes_gpc&quot; setting, it is not guaranteed to be ON in all server configurations, in fact, I turn it OFF in EVERY server configuration I do.  It causes more headaches than it&#039;s really worth.  With PHP, you can use the PDO library to prepare your SQL statements, and sanitize the input in a MUCH MORE secure manner than either of the two methods Andrew mentions.

Finally, I don&#039;t want to come off as a conceited, or look like I&#039;m downing Andrew - I appreciate him trying to contribute to the community, and help new developers out - the community definitely benefits from these sorts of people.  So, thank you Andrew for sending chris your tips!  Without you sending them, I probably wouldn&#039;t have been prompted to share what I am about to share.

I have a few more methodological type points of advice for new developers.


  1. Never, ever trust what a user of your site gives you, ever.
    Always error check, and sanitize your field inputs. ESPECIALLY when you are outputting that data on the page, or interacting with a file that exists on your file system.  Its TRIVIAL for a user to type in some html in their text box, or &quot;../../../../../../../../../../../../etc/passwd&quot; to access your server password file.

So, a few tips when dealing with those types of fields:

1. If you&#039;re going to output the stuff a user types in, always, always, yes even if you don&#039;t feel like it, call htmlspecialchars on the data, and sanitize it using the *sql functions of php (mysql_real_escape_string, PDO bind param, whatever).

2. If you&#039;re dealing with the name of a physical file, call the function basename on the input (as well as using a regular expression checking for illegal characters in the filename)

On some related notes:

3. If you don&#039;t know what regular expressions are, time for some googling. There are lots of sites offering tutorials and other help with them (regexlib.com comes to mind).  Regular expressions are incredibly powerful, and despite what anyone says, absolutely awesome and appropriate when used in moderation.

4.  Get in the habit of commenting, and ORGANIZING your code!  Nothing is more frustrating than when you come back to a project 3 months after not working with it - and not understanding a lick of what it does!  Organization and comments will ALSO help you explain any problems you&#039;re having to another developer (meaning, you&#039;ll get better help - faster).  Once you&#039;ve made it a habit, you won&#039;t ever have to worry about it again - because you&#039;ll do it automatically!

5.  If you&#039;re unsure, ask for help.  Use IRC (efnet, freenode), read blogs, read the comments on php.net documentation pages (they&#039;re astonishingly helpful), stackoverflow.com has some resident php geniuses even.

Finally, remember, the community is only as good as the people inside it.  If you come across a real you-know-what, don&#039;t bother fighting, be the bigger person and move on. Someone knows the answer, there is no reason you have to deal with someone who is hurting the community of developers when there are thousands of people willing to help you. You just have to know who to ask.

I hope these tips are useful to someone, thanks for reading them and Good Luck!</description>
		<content:encoded><![CDATA[<p>I was surprised to see a post like this on your site Chris..knowing that you&#8217;re not exactly of programmer background &#8211; having said so yourself.  I&#8217;m a full time developer, and while most of these tips are very basic, there are two that I&#8217;d like to &#8220;add more&#8221; to.</p>
<p>Firstly, as for detecting if PHP is set up correctly..use the php -i command from the command line, or phpinfo() function on a php file loaded through your web server.  This will allow you (the setter-upper) to tell if all the modules you expected to be loaded, are loaded properly.  For example, when you load the MySQL extension into php, there will be a section of `php -i` or phpinfo() labeled &#8220;mysql&#8221; and will show some default server variables for the module, letting you know that the MySQL client library is loaded and available to php.</p>
<p>Secondly, in reference to using &#8220;addslashes&#8221; and &#8220;magic_quotes_gpc.&#8221;  DON&#8217;T!  The &#8220;addslashes&#8221; function is *absolutely not suitable* for sanitizing database input.  It does not do anything more than add backslashes before apostrophes in a string, and does not take into account the databases&#8217; character set collation.  As for the &#8220;magic_quotes_gpc&#8221; setting, it is not guaranteed to be ON in all server configurations, in fact, I turn it OFF in EVERY server configuration I do.  It causes more headaches than it&#8217;s really worth.  With PHP, you can use the PDO library to prepare your SQL statements, and sanitize the input in a MUCH MORE secure manner than either of the two methods Andrew mentions.</p>
<p>Finally, I don&#8217;t want to come off as a conceited, or look like I&#8217;m downing Andrew &#8211; I appreciate him trying to contribute to the community, and help new developers out &#8211; the community definitely benefits from these sorts of people.  So, thank you Andrew for sending chris your tips!  Without you sending them, I probably wouldn&#8217;t have been prompted to share what I am about to share.</p>
<p>I have a few more methodological type points of advice for new developers.</p>
<p>  1. Never, ever trust what a user of your site gives you, ever.<br />
    Always error check, and sanitize your field inputs. ESPECIALLY when you are outputting that data on the page, or interacting with a file that exists on your file system.  Its TRIVIAL for a user to type in some html in their text box, or &#8220;../../../../../../../../../../../../etc/passwd&#8221; to access your server password file.</p>
<p>So, a few tips when dealing with those types of fields:</p>
<p>1. If you&#8217;re going to output the stuff a user types in, always, always, yes even if you don&#8217;t feel like it, call htmlspecialchars on the data, and sanitize it using the *sql functions of php (mysql_real_escape_string, PDO bind param, whatever).</p>
<p>2. If you&#8217;re dealing with the name of a physical file, call the function basename on the input (as well as using a regular expression checking for illegal characters in the filename)</p>
<p>On some related notes:</p>
<p>3. If you don&#8217;t know what regular expressions are, time for some googling. There are lots of sites offering tutorials and other help with them (regexlib.com comes to mind).  Regular expressions are incredibly powerful, and despite what anyone says, absolutely awesome and appropriate when used in moderation.</p>
<p>4.  Get in the habit of commenting, and ORGANIZING your code!  Nothing is more frustrating than when you come back to a project 3 months after not working with it &#8211; and not understanding a lick of what it does!  Organization and comments will ALSO help you explain any problems you&#8217;re having to another developer (meaning, you&#8217;ll get better help &#8211; faster).  Once you&#8217;ve made it a habit, you won&#8217;t ever have to worry about it again &#8211; because you&#8217;ll do it automatically!</p>
<p>5.  If you&#8217;re unsure, ask for help.  Use IRC (efnet, freenode), read blogs, read the comments on php.net documentation pages (they&#8217;re astonishingly helpful), stackoverflow.com has some resident php geniuses even.</p>
<p>Finally, remember, the community is only as good as the people inside it.  If you come across a real you-know-what, don&#8217;t bother fighting, be the bigger person and move on. Someone knows the answer, there is no reason you have to deal with someone who is hurting the community of developers when there are thousands of people willing to help you. You just have to know who to ask.</p>
<p>I hope these tips are useful to someone, thanks for reading them and Good Luck!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Rogers</title>
		<link>http://chris.pirillo.com/tips-for-programming-and-php/#comment-716305</link>
		<dc:creator>Mike Rogers</dc:creator>
		<pubDate>Wed, 01 Jul 2009 03:04:07 +0000</pubDate>
		<guid isPermaLink="false">http://chris.pirillo.com/?p=13591#comment-716305</guid>
		<description>Good article, however I disagree with a few of your points.

I think newbies to PHP should install programmes such as XAMPP and when they are confident, they can move on to the fun of installing PHP and Apache.

Asking help from communities is good, but some &quot;professional coders&quot; use forums incorrectly and end up asking questions in a stupid manor. For example they may not provide problem code or may just try to get someone to do their work for free.</description>
		<content:encoded><![CDATA[<p>Good article, however I disagree with a few of your points.</p>
<p>I think newbies to PHP should install programmes such as XAMPP and when they are confident, they can move on to the fun of installing PHP and Apache.</p>
<p>Asking help from communities is good, but some &#8220;professional coders&#8221; use forums incorrectly and end up asking questions in a stupid manor. For example they may not provide problem code or may just try to get someone to do their work for free.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JV</title>
		<link>http://chris.pirillo.com/tips-for-programming-and-php/#comment-716301</link>
		<dc:creator>JV</dc:creator>
		<pubDate>Wed, 01 Jul 2009 02:44:27 +0000</pubDate>
		<guid isPermaLink="false">http://chris.pirillo.com/?p=13591#comment-716301</guid>
		<description>Not a pro, but have done installs manually as well as via XAMPP &amp; WAMP on windows, and the automated installers on Linux (Ubuntu). Definitely good to learn, but can&#039;t emphasize how much better it is to have an automated installer do the job right, and if you need to, uninstall and do it again if (when) you screw up.  All other advice is fine, but not very useful for really learning. Get a good book or 3, and if you can, hang with a PHP pro to learn more. Some are actually helpful, tho you&#039;ll find some to be tough on &quot;newbies&quot;, as I&#039;ve learned, so you&#039;ll need thick skin.  Google for help and hit forums, like http://groups.google.com/group/alt.php/topics

Most of all, relax and enjoy the wild ride.</description>
		<content:encoded><![CDATA[<p>Not a pro, but have done installs manually as well as via XAMPP &amp; WAMP on windows, and the automated installers on Linux (Ubuntu). Definitely good to learn, but can&#8217;t emphasize how much better it is to have an automated installer do the job right, and if you need to, uninstall and do it again if (when) you screw up.  All other advice is fine, but not very useful for really learning. Get a good book or 3, and if you can, hang with a PHP pro to learn more. Some are actually helpful, tho you&#8217;ll find some to be tough on &#8220;newbies&#8221;, as I&#8217;ve learned, so you&#8217;ll need thick skin.  Google for help and hit forums, like <a href="http://groups.google.com/group/alt.php/topics" rel="nofollow">http://groups.google.com/group/alt.php/topics</a></p>
<p>Most of all, relax and enjoy the wild ride.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Grissom</title>
		<link>http://chris.pirillo.com/tips-for-programming-and-php/#comment-716300</link>
		<dc:creator>John Grissom</dc:creator>
		<pubDate>Wed, 01 Jul 2009 02:37:54 +0000</pubDate>
		<guid isPermaLink="false">http://chris.pirillo.com/?p=13591#comment-716300</guid>
		<description>Also Dont be afraid to try something PHP will give you the errors and what line they are on and the reason it is throwing the error.

I have found that http://phpfreaks.com/ is a good website (Forum), with very good PHP developers that are there to help you. also dont be afraid to google your errors, there are many web sites out there with people that either have or gotten the same error with a correct way to fix the error.

if you are a beginner with php I recommend grabbing a few books from your local library or book store.

There are many websites on the internet that have wonderful tutorials 

http://www.w3schools.com 
http://www.tutorialized.com

or you could google for PHP tutorials.

I have been messing with PHP for about 5 years now and still use google or look into books for references when I have problems.

I hope that this could help someone that would like to learn PHP

~John Grissom 3</description>
		<content:encoded><![CDATA[<p>Also Dont be afraid to try something PHP will give you the errors and what line they are on and the reason it is throwing the error.</p>
<p>I have found that <a href="http://phpfreaks.com/" rel="nofollow">http://phpfreaks.com/</a> is a good website (Forum), with very good PHP developers that are there to help you. also dont be afraid to google your errors, there are many web sites out there with people that either have or gotten the same error with a correct way to fix the error.</p>
<p>if you are a beginner with php I recommend grabbing a few books from your local library or book store.</p>
<p>There are many websites on the internet that have wonderful tutorials </p>
<p><a href="http://www.w3schools.com" rel="nofollow">http://www.w3schools.com</a><br />
<a href="http://www.tutorialized.com" rel="nofollow">http://www.tutorialized.com</a></p>
<p>or you could google for PHP tutorials.</p>
<p>I have been messing with PHP for about 5 years now and still use google or look into books for references when I have problems.</p>
<p>I hope that this could help someone that would like to learn PHP</p>
<p>~John Grissom 3</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 1/6 queries in 0.329 seconds using disk: basic
Object Caching 416/420 objects using disk: basic
Content Delivery Network via Amazon Web Services: CloudFront: s3.pirillo.com

Served from: chris.pirillo.com @ 2012-02-15 16:47:36 -->
