Join 3,562 readers in helping fund MetaFilter (Hide)


PerHaPs SeQuentiaLly?
May 4, 2008 5:45 AM   Subscribe

Which version of PHP should I start to learn, and how? I know HTML and CSS, and intend to build with Drupal (or similar) and its many extensions.

I've decided to start learning PHP, and I'd like to do it right. My end goal, for this initial project, is to ultimately build a Metafilter-like site with PHP and MySQL, perhaps with something like Drupal on top of it. I'd like to have a strong sense - if not a complete understanding - of each layer of the process, but I need some direction.

I do well with books and videos (rather than pdfs or websites), but in browsing Amazon, I realize I don't know if should be reading about PHP 5 or 6 - as I expect most of the modules I'll want are only 5-friendly. Any advice? Are there specific Dummies, and Dummies-like books you can recommend? Ideally, it will also cover MySQL. I'm also open to books on Drupal, if they're any good. Does anyone have feedback on the Lynda videos?

So:
Learn PHP 5 or 6?
How?

Finally, a bonus question: I'm certainly going to have many questions going forward - from installation right on. Can you recommend a good resource for someone at my level? I know there is certainly no dearth of forums (fora?), but I'm looking for the BEST one to devote myself to and invest in.

(I have spent days looking through previous threads - they do exist, but they're either old or not exactly on-target).
posted by prophetsearcher to Computers & Internet (12 answers total) 7 users marked this as a favorite
 
What platform will you be developing on?

If windows WAMP pretty good.

If linux you can apt get the packages pretty easily anyway.

I'd probably dev in 5, cause you know your hosting company will support it. Nothing worse than functionality that relies on a module your host doesn't support. Keep an eye on 6.

PHP Builder is probably the granddaddy of PHP resource sites.

You will want to do the PHP tutorial, and the PHP Manual is indispensable.

Good luck
posted by mattoxic at 6:22 AM on May 4, 2008


The short answer is it doesn't really matter. Current versions of Drupal don't use *any* object-oriented or new PHP6 features (yet).

I like Pro Drupal Development, which you can buy as PDF.
posted by meta_eli at 6:52 AM on May 4, 2008


In my opinion, you would really benefit from learning the object-oriented version of PHP. I've become familiar with it in working with Symfony recently, and it's been entirely too rewarding.

However, there's nothing really "php-specific" about the approach you can take to understanding the language. If you don't already have a programming foundation, you should consider reading some books on general programming techniques and approaches. These will be useful and necessary no matter what language you're working in.
posted by odinsdream at 7:30 AM on May 4, 2008


What platform will you be developing on?

I actually cut the part of the question out, since I thought I was getting greedy. In fact, I am on a Mac, and began investigating MAMP, XXAMP, etc., but decided to try to install a Windows XP VM instead and work of that, to keep things relatively simpler.

Does that make sense?
posted by prophetsearcher at 7:56 AM on May 4, 2008


I never really learn a language until I make something with it. I can read a bunch of books, and follow along with tutorials and mailing lists, but until I think of a project I want, the language is just this interesting thing.

PHP 6 looks nice, but I don't see it being used in any major way for a few years. I'd start with 5, and second the recommendation to use OO.

If using a vm got you up and running quick then it's a great solution, though its worth noting that leopard ships with php and sqllite (or patches them in maybe? I don't recall the specifics) which will be a reasonable start for most anything.
posted by cCranium at 8:43 AM on May 4, 2008


I'd start with 5.. 4 is still in wide production use all over the place - 5 is starting to take it's place.
6 will just be a nice change.
posted by TravellingDen at 9:13 AM on May 4, 2008


if you're using a mac, you already have apache installed. You can compile php yourself or get a precompiled version of php5.

As for learning... you need to learn the language first and not get bogged down in libraries and frameworks. Start with simply adding some simple php <php print 'hello'; ?> to webpages. Then start building more elaborate examples. A video tutorial of someone writing code sounds extremely dull. It's much more engaging to simply type some code, save page, click reload in the browser and see what happens.

Eventually, you'll find that mixing php with HTML makes a nasty mess for anything non-trivial, and then you'll want a templating system. Check out Smarty.

I really wouldn't mess with something like Drupal for learning PHP. It's totally overwhelming and you'll just pick up bad habits, like not using objects, putting all methods in the global namespace, mixing HTML and php together.

oh, and the official php website is an excellent learning resource.
posted by kamelhoecker at 9:25 AM on May 4, 2008


Oy! Don't try to develop PHP under windows if you already have a mac. It's going to be a lot easier natively or under a Linux VM if you must.
posted by beerbajay at 9:33 AM on May 4, 2008


Don't bother with the built-in Apache; get MAMP PRO and you can easily set up multiple sites, keep things tidy and not have to reinstall/reconfigure lots of stuff every time you upgrade the OS. I use it every day despite being perfectly able to manually hack about with httpd.conf etc.

Learn PHP5 and try out some of the simpler frameworks. You don't need to dive into heavily-OO stuff right away, you can go a long way with just the basics and pick up OO techniques gradually. It's hugely important to be aware of security issues such as XSS, CSRF, SQL injection, and email injection.
posted by malevolent at 10:08 AM on May 4, 2008


MAMP Pro is seeming like a better and better idea --- unfortunately the website has been down since at least yesterday (AFAI can tell...).

As advised above, I do plan to learn the language by working on a "real-world" project. In this case, trying to replicate a metafilter-type site. It seems to have a lot going for it: user accounts, permissions, intrigue, scandal...

Sounds like 5 is the way to go.

I'll try not to even look at Drupal (or the like) for a good while, until I get the basics down.

Any other wisdom welcome!
posted by prophetsearcher at 2:16 PM on May 4, 2008


Yeah... if history is any indicator, we'll have php5 for a good long time. 4.x is still really, really common in shared hosting environments and 5 has been out for what seems like forever.
posted by ph00dz at 9:35 PM on May 4, 2008


You're definitely not making things easier on yourself by going through a Windows virtual machine to install PHP. Stick to the Mac.
posted by odinsdream at 8:03 AM on May 6, 2008


« Older Is there a Windows program tha...   |  face down, ass up - what do yo... Newer »
This thread is closed to new comments.