164 Comments
- c0ldfusi0n, on 10/29/2007, -0/+43It's starting already, so i'll say this here and now to the flamers, trollers and other mischievous creatures floating around the diggspace. PHP is a good programming language. One of its disadvantage is that it's rather easy to learn, so there's a whole lot of poorly coded applications and websites on the internet. Don't flame the /real/ competent and professional PHP coders because 3/4 of the PHP /programmers/ can't code properly.
- immortalize, on 10/10/2007, -8/+49PHP is a great tool depending on the application and a wonderful way for inexperienced coders to write gaping security holes.
- Flashman, on 10/10/2007, -3/+34"perhaps you shouldn't be on digg in the programming section?"
Dude, that's a bit elitist. We all have to start somewhere. - inactive, on 10/10/2007, -1/+26i know some other languages and i find php is pretty quick to pick up if you know the basics on how programming works. (functions, variables, structure)
- shinynew, on 10/29/2007, -5/+26your comment >= wtf
- m4rk0551, on 10/10/2007, -23/+39I decided to post this because like myself, I have 0% knowledge on php, and I have never attempted at it because it looks sooo confusing. This site changed it and I can guarantee people a like myself will feel the same way.
- fuzzmeister, on 10/10/2007, -1/+17The best way to learn PHP, in my opinion, is to start a project and learn as you go. Of course, you will have to go back and recode 90% of it when you get to the end (when you actually know PHP well), but it's a great way to learn the language.
- haveacigar, on 10/10/2007, -4/+19http://www.duggmirror.com
- kristopherw, on 10/10/2007, -1/+13Too bad it doesn't provide an introduction into object-oriented (and polymorphic) PHP; because you can do some real sweet things with objects in PHP.
- xTRUMANx, on 10/10/2007, -3/+14Why digg? Why must you bury the poor guys comment. What mistake has he done to deserve to be buried.
- thailand1972, on 10/10/2007, -1/+11Agree with Flashman, enough of the elitist crap. I've been a programmer for well over 20 years, and I find some languages confusing not because of their logic, but simply their syntax. Horses for courses.
- jmickey, on 10/10/2007, -2/+12I was curious and clicked Part 5: Rank and File. After seeing this line of code I have no choice but to digg this down and hope that people look elsewhere for tutorials:
$file = '/usr/local/stuff/that/should/be/elsewhere/recipes/omelette.txt' or die('Could not open file!'); - thecheatah, on 10/10/2007, -0/+9I love you: http://www.php.net
- NinjaBoy, on 10/10/2007, -0/+9You need to stop assuming that English is everyones primary language.
- zachninme, on 10/10/2007, -0/+9"Python or Ruby. They're better."
You didn't expect *that* now did you? - Moosebern, on 10/10/2007, -0/+8OMGZ!!!!! He totally didn't use a word right. LOLZ!!!!
Stop being a grammar/spelling/syntax nazi. - p0tent1al, on 10/10/2007, -1/+9Any minute now the Ruby-On-Rails idiots are going to come into this thread.....
- eplawless, on 10/10/2007, -1/+9Teaching a programming language without teaching the basics of security is terrifying, and non-programmers won't understand why it's important.
It's like teaching c++ without mentioning that you perhaps shouldn't have public arrays. - lunarvision, on 10/10/2007, -0/+6Sure, his (Cwo655321’s) comments are ambiguous, but is anybody surprised? He’s a smug-acting programmer, and in my experience, a lot of programmers are notoriously despicable communicators and usually have the interpersonal skills (and hygiene) of a hibernating bear. Good luck getting any semblance of objectivity, consistency, or understanding/empathy from a jerk like Cwo655321.
So, from all of “ass munch’s” friends, to all of them (the unshaven, WoW lot) - THANK YOU for ruining digg, and an honest, insightful post that may enlighten a few folks. Now shuffle back down to the basement and finish the website I paid you for!! - loudthing, on 10/10/2007, -0/+6REAL MEDIA VIDEOS!?!?!? God, are REAL videos EVER going to die!?
- dnthomps, on 10/10/2007, -3/+9Too funny. I found this page yesterday and took the first 5 lessons. Come in to work today to get to it, and it's down. So I allow myself about 2 seconds to wonder why the ***** its down, and say 'screw it' and start heading to Digg. What do you know, 8th posting down on the front page of Digg. Damn you Digg.
Anyways... here are the first 10 lessons if you can't wait:
Zend Developer Zone | PHP 101 (part 1): Down the Rabbit Hole
http://72.14.253.104/search?q=cache:MoTaOFRsiZ4J:devzone.zend.com/node/view/id/625+PHP+101+(part+1)&hl=en&ct=clnk&cd=1&gl=us
Zend Developer Zone | PHP 101 (part 2): Calling All Operators
http://72.14.253.104/search?q=cache:oCZluMuwap0J:devzone.zend.com/node/view/id/626+PHP+101+(part+2)&hl=en&ct=clnk&cd=1&gl=us
Zend Developer Zone | PHP 101 (part 3): Looping The Loop
http://72.14.253.104/search?q=cache:0jGrp78cyd0J:devzone.zend.com/node/view/id/628+PHP+101+(part+3)&hl=en&ct=clnk&cd=1&gl=us
Zend Developer Zone | PHP 101 (part 4): The Food Factor
http://72.14.253.104/search?complete=1&hl=en&q=cache%3Ahttp%3A%2F%2Fdevzone.zend.com%2Fnode%2Fview%2Fid%2F635&btnG=Google+Search
Zend Developer Zone | PHP 101 (part 5): Rank and File
http://72.14.253.104/search?q=cache:U19ZZKKF1twJ:devzone.zend.com/node/view/id/636+PHP+101+(part+5)&hl=en&ct=clnk&cd=1&gl=us
Zend Developer Zone | PHP 101 (part 6): Functionally Yours
http://72.14.253.104/search?q=cache:nUPQ0y_6AnsJ:devzone.zend.com/node/view/id/637+PHP+101+(part+6)&hl=en&ct=clnk&cd=1&gl=us
Zend Developer Zone | PHP 101 (part 7): The Bear Necessities
http://72.14.253.104/search?q=cache:oWnTy9zPO5kJ:devzone.zend.com/article/638-PHP-101-part-7-The-Bear-Necessities+PHP+101+(part+7)&hl=en&ct=clnk&cd=1&gl=us
Zend Developer Zone | PHP 101 (part 8): Databases and Other ...
http://72.14.253.104/search?q=cache:rO2ETy7vMhcJ:devzone.zend.com/article/641-PHP-101-part-8-Databases-and-Other-Animals---Part-1+PHP+101+(part+8)&hl=en&ct=clnk&cd=1&gl=us
Zend Developer Zone | PHP 101 (part 9): SQLite My Fire!
http://72.14.253.104/search?q=cache:fd1QNWOlfCEJ:devzone.zend.com/article/644-PHP-101-part-9-SQLite-My-Fire---Part-1+PHP+101+(part+9)&hl=en&ct=clnk&cd=1&gl=us
Zend Developer Zone | PHP 101 (part 10): A Session In The Cookie Jar
http://72.14.253.104/search?q=cache:Ndiwiia5vTgJ:devzone.zend.com/article/646-PHP-101-part-10-A-Session-In-The-Cookie-Jar+PHP+101+(part+10)&hl=en&ct=clnk&cd=1&gl=us - ayeroxor, on 10/10/2007, -6/+12"like myself, I have 0% knowledge on php" "I can guarantee people a like myself"
You need to stop using the word "myself" until you understand it. - fLUx1337, on 10/10/2007, -2/+7PHP is VERY secure......if your not dumb and leave messy code!
Its my main programming language and I'm proud I have it - zachninme, on 10/10/2007, -5/+10Ugh, as immortalize said, PHP just leaves too many holes. I bet the problem is most newbie programmers are too proud to use frameworks (which they should), and haven't read security papers. Theres a thing called mysql_real_escape_string ya'know!
Also, python is a much nicer language, and you can use it to make applications too, so it saves you a language. If you use django, which is a kick-ass framework that makes your life SOOO much easier, you'll save yourself the trouble of learning SQL as well. (And although tutorials on this might seem simple, from my experience mentoring people, you'll see SQL WTF's for their first 1-3 months.)
If you still must learn PHP, use a framework. It won't make you any less of a man, I promise.
And yes, there are some great PHP apps out there, but since this is a tutorial, I'm going to say that 95% who'll need this are going to be PHP newbs, and thus my comment is directed at them, not the PHP geniuses. - zachninme, on 10/10/2007, -1/+6PHP is the Gentoo of programming languages. (Thats not good gentoo users ;-) )
If you're anti-Ubuntu, HTML is your guy, as everyone calls it programming but it really isn't.
If you're pro-Ubuntu, JS is it, as any idiot can install a simple script, yet amazing things can be done with it, just look at AJAX - Klowner, on 10/10/2007, -0/+5Huzzah for Django (and the heaps of other Python web frameworks) or Rails
- jtb4, on 10/10/2007, -0/+5Just use MS Word and say "Save as web page". It creates really streamlined code, with truly extensible XML syntax that is based on world standards and not just Microsoft. You can also save Excel spreadsheets and quick lightweight Powerpoint presentations with things like letters that fade and fly on the screen. Just my 2 cents.
/sarcasm - capiCrimm, on 10/10/2007, -0/+4well I didn't want him to actually ***** himself over.
- Nick22, on 10/10/2007, -0/+4Its not even that hard or complicated to prevent most security problems like SQL injections, I dont quite understand what all the fuss is about. If your going to be coding anything that involves peoples information you shouldnt even need to be told that it should be secured, and once you look up how to do it its actually pretty easy
- capiCrimm, on 10/10/2007, -0/+4He's saying that digg used to be a good place for programmers, but now because of all the non-programmers it's starting to suck for programmers. In his original comment the "all of us" should be changed to programmers and tech geeks. It's ambiguous the way it is currently, and hopefully I interpreted him correctly since he won't explain himself.
- tempusrob, on 10/10/2007, -0/+4Trial & Error is OK for some situations, but so many issues with poor PHP code could be avoided if the idea of "validate and/or sanitize EVERY SINGLE piece of user input" was drilled over and over and over before people were allowed to write <?php echo 'Hello world!'; ?>
- thailand1972, on 10/10/2007, -1/+5http://www.ukuug.org/events/linux2002/papers/html/php/index.html
"PHP is a convenient language for rapidly prototyping simple dynamic websites. Websites thus built can in many cases be deployed indefinitely, without spending time and money on refactoring code in a different language. PHP’s simplicity makes it a good language for inexperienced programmers, such as those moving from a pure page-design rôle to a site development one.
For more experienced developers, though, the language’s simplicity rapidly turns into complexity, slowing down the development process. These developers are the ones who have the skills needed to build large and/or complex websites; using PHP for such sites therefore tends to be a net loss. This tendency is reinforced by PHP’s lack of the linguistic features needed to promote working on large software projects. If your project is at all large or complex, it may be better to look elsewhere when choosing an implementation language." - zachninme, on 10/10/2007, -0/+4Owch.
Next thing you know, $file's going to become a $_GET variable, and then you'll have people viewing every single one of your computer's files! Joy! - smart88, on 10/10/2007, -6/+10You can also use some of these videos http://freevideolectures.com/webdesign.html to learn PHP.
- Mike89, on 10/10/2007, -0/+4Can someone explain to me the correct way would be to go about this, then? I may learn PHP and i'd be interested to know.
- bradleyland, on 10/10/2007, -1/+5Which brings up a good point. Why are there a million and one introductory PHP articles on the web, but very few "how to secure your PHP application" articles? In our organization, we're writing mostly Ruby on Rails stuff these days, so the framework handles most of the security basics, but I quite frequently write simple stuff in PHP where I don't want to use the Rails framework, or where I want more flexibility in hosting. I've read up on SQL injection, I don't use hosts that enable registered globals, and I always validate form input on the server side before proceeding. I'd love to see an article like this, but focusing on security.
- crawf061, on 10/10/2007, -0/+4This question would have been more fun with haiku answers...
- markstory, on 10/10/2007, -0/+3Any programming language can have these same problems. Whether it be perl or python, they all are just as vulnerable when weilded by someone who knows not of injection attacks and XSS. As others have posted there are just bad PHP programmers, and furthermore everyone is bad at somepoint. Just happens that a lot of people learn PHP first. As for passwords, it really depends on the security of the site / application. For myself general to low security -> MD5. For higher security I use mcrypt with either DES or rijndael algorithms.
- Nick22, on 10/10/2007, -0/+3Agreed, most of what I know comes from various projects that iv worked on. Whatever I cant figure out a problem via trial and error and/or the manual, I just go post in some PHP forum and I end up learning something really useful
- inactive, on 10/10/2007, -0/+3if ((diggs != hits) && (beatryder = idiot))
{
digg down beatryder;
} - capiCrimm, on 10/10/2007, -0/+3So what's Haskell?
- Firehed, on 10/10/2007, -0/+3This is why I went and spent twenty bucks on a book on the subject - Essential PHP Security (one of those O'Reilly ones). It's a fairly quick read but covers the essentials of how to avoid stupid but common errors - pretty much anything that can happen by trusting user input (SQL injection, cross-site scripting, etc).
In honesty, it's nothing that you can't learn from Google and knowing the right websites, but that's true of just about anything these days. It's quite nice to have a resource you can physically handle, and have a specific, centralized thing. For anyone looking to develop in PHP, I'd quite recommend grabbing a copy.
Amazon: http://urltea.com/17ey or ISBN-13: 978-0596006563 at your store of choice. - thailand1972, on 10/10/2007, -0/+3Digg uses a lot of hardware - 20 database servers and 30 web servers. Digg is a good example of how bad PHP scales.....
More info:- http://www.computerworld.com/action/article.do?command=viewArticleBasic&articleId=9017778&pageNumber=2 - eplawless, on 10/10/2007, -1/+4public arrays specifically = buffer overflows = *****
- LowRentDiggs, on 10/10/2007, -0/+3http://www.google.com/search?q=secure+php
there are frameworks for php also - dbr_onix, on 10/10/2007, -1/+4What the ferk are you talking about? For one, this article is refering to PHP, which I'd consider more of an "Ubuntu" than Python is - It's what a lot of people start programming with, and a lot of web developers use it because it's more or less what it's intended to do (PHP = Hypertext Preprocessor, so it makes sense to use it for creating websites..)
PHP was the first 'proper' language (I played around with other things like the Lego Mindstroms programming stuff, P-BASIC and a few others before starting PHP, but they aren't really practical languages..) I used, I then learned Perl (mostly for command line applications - which is one place I hated using PHP for, which is good as I don't like using Perl for web applications - PHP for web, and Perl for CLI)
But, recently I decided to learn Python - It's an incredibly easy language to learn (And not to a 'hello world' level, within writing not many scripts, I can do reasonably advanced stuff (classes, list-comprehension, writing modules)
It probably helps that I'd learned PHP/Perl before, but regardless - I have a friend who wanted to start programming, so I suggested Python, and despite the fact he'd never programmed before, with a tutorial or two he had picked up the basics in a single evening.
I'd recommend Python to anyone who's learned PHP - Not because "it's cool" or such, but because it's a nice language to use. I'd still recommend learning a language like PHP, mostly because it's syntax is more 'standard' - Just make sure you get in the habit of properly indenting your code - capiCrimm, on 10/10/2007, -1/+4I still don't understand. I've never heard it said that way? When you say public you mean a public array of a class, or do you mean reading in stuff without bounds checking?
- antdude, on 10/10/2007, -0/+3http://duggmirror.com/programming/Want_to_learn_Php_Easy/ for referrer blockers.
- Eevee, on 10/10/2007, -2/+5PHP is full of cruft left over from bad design decisions, functionality that was shoehorned into a syntax far too C-like, one big namespace full of inconsistently named functions, too many similar ways to accomplish similar tasks, and a manual that still encourages bad security practices. Every time I go to add to some PHP app I find myself spending far too much time fighting idiosyncrasies in the language, regardless of how good or bad the code itself is. It was designed to be a fancy SSI and it has far outgrown itself.
I have no interest in starting a flamewar; I just think the problems with PHP's design far outweigh any advantages it offers. Tolerable for certain small applications, perhaps, but I can't really call it a good programming language. -
Show 51 - 100 of 156 discussions



What is Digg?
Digg is coming to a city (and computer) near you! Check out all the details on our