Get started with PHP and Scripting

GilesGuthrie

Staff Emeritus
11,038
United Kingdom
Edinburgh, UK
CMDRTheDarkLord
PHP isn't a difficult language, especially for anyone who's done any C, but here are some of the things that helped me to get going...

PHP is a free (open source) language, and it fits together with MySQL, the open source version of the SQL database system. The thing for me was that my PHP work was integral with learning MySQL.

Books
PHP and MySQL Web Development, by Luke Welling & Laura Thomson was an excellent book. It runs you through a crash course in programming in general, then onto some more advanced PHP stuff. After this, it starts on the database stuff, walking you through creating databases and tables in MySQL. A lot of this isn't really relevant, because it requires console, or shell access to the server, which most commercial web hosts will not allow. However, if you remember that you can shove most of the MySQL commands in the PHP function mysql_query() you won't go far wrong. But see the Software section for more on the early actions in MySQL

Database Design for Mere Mortals: A Hands on Guide to Relational Database Design by Michael J. Hernandez is an amazingly dull-sounding book, but it's not too bad, and it gives you a heads-up on the concept of database design. This is especially helpful if you have a project in mind, but can't think of how to lay out the data in a database. You probably won't need to read it all though!

Javascript for the World Wide Web by Tom Negrino and Dori Smith is an excellent introduction to Javascript, although it is quite brief and the examples are quite limited. All the "... for the World Wide Web" books are like this (I also have Perl and CGI... and Java...), and should only really be treated as introductions.

Software
Most of the software you need for proper web programming is on the server side, and should therefore be provided by your web host. The number of free hosts that supply PHP and MySQL capabilities is quite small, but you don't need to pay the Earth for these facilities either. Somewhere in the region of $9 per month should be all you need to shell out for a top-rate web host.

If you have a server kicking about, you can build it yourself, particularly if you have a broadband connection. Remember that if it's a testing server (i.e. not the one your web site is running off), then it doesn't need to be a ninja - I've got Linux, Apache, MySQL and PHP running on a PentiumPro 200 box with 320MB RAM. If it is going to be your production server, you'll need your own static IP address, which can be expensive. You'll also need to find out what your upstream bandwidth is, because this will determine the data rate for pages going out to other users. Most broadband companies only quote the downstream rate, which is no use if you're running servers.

Software then...

If you can afford it, Dreamweaver MX is very good, not least because with the MX version, PHP support is built in. This means it can help you to code, but it's no substitute for getting your hands dirty.

On the server side, you are best off using Linux (I use Red Hat) as the operating system. Onto that, you need to build Apache, the open source web server software. Compile it with the PHP extensions, and then add MySQL on top. If you download all three discs of Red Hat Linux, you'll find all the software in packages on the second disc.

Absolutely essential is phpMyAdmin, which can be downloaded from www.phpwizards.net. It's a web control interface for your MySQL database, and it does the following:
  • Create, edit and delete tables (i.e. the complicated stuff)
  • Insert, modify and delete data
  • Show the MySQL commands used at all time (helping you to learn)
  • Execute and debug MySQL commands (allowing you to see why your scripts aren't working)

Point 1 is very important, because messing about with tables is a prime way to really trash your database, and if you do that early on, you're likely to get disheartened. Also, Point 2 lets you get started on retrieving data from the database.

There, that should help you get started! Good luck :)
 
Just to add a little...

The way i learned php, and got to where i am now, was just by looking first hand at PHP scripts such as vBullettin and experimenting with the coding it contained. Just as Giles said, its not that hard to learn, but it may take a little while. Understanding every single function is probably just about impossible, unless youre on the PHP creators team yourself. ;) - I had a few books and websites to help me along the way; if i didnt know a certain function, or what a piece of code did, i would look it up in the book or on other PHP-help forums.

A really good source to get help for PHP scripting would have to be at www.TutorialForums.com; they have a forum dedicated to PHP (Actually, its called server-side scripting,) and there are many members and administrators there to help you.

Also, to go against something that Giles said, PHP runs well on any operating system. I have it running on the computer im using right now, and im running Win98. Sure, its not the most stable system, but PHP runs on it pretty well, as well as Apache and MySQL; which are integral to actually being able to run PHP off of your own system (you need broadband too!)

If your having problems with your script, you will usually get an error when attempting to run it. The most common error scripters receive is this: "Parse error: Parse error, unexpected ___ at ___ on line ____"; - This usually means that there is a character that youre either missing, or just have used wrong on that line. Before coming to someone consulting help, make sure you check your script as thoroughly as you can. 90% of the time, errors are just simple spelling mistakes, or a missing colon (";").

Always remember that both me, Giles and other people are here at the GTP to help you with your scripting needs. If you have had a thread posted here that hasnt been responded to, try PM'ing one of us with your problem/question.

Also, if we for some reason cant help you, dont be afraid to mozey on over to www.TutorialForums.com, and ask for help!

Good luck! :)
 
Great effort guys! I'll get back to you two when I get the urge to put out some web material. :)

Oh, and it's sticky now. Thanks to Acid, here, for the heads up!
 
Well, I've been combing the net for several weeks now on PHP/MySQL development with little luck. My problem is that most the examples and supplied code assumes that you (myself) has prior knowlege of the language, of which I have absolutely none. :)

I have ordered this book:

PHP and MySQL Web Development, by Luke Welling & Laura Thomson

Per GG's suggestion and look forward to working through it's examples. Another publication that has sparked some interest is this one:

PHP MySQL Website Programming: Problem - Design - Solution,by Chris Lea, Mike Buzzard, Jessey Cinis, Dilip Thomas

So without further delay, I'll post my views of these materials from a pure n00b perspective. ;)

:cheers:
 
I'm currently a reading PHP and MYSQL Web Development book by Luke Welling and Laura Thomson. It has 800 pages , I'm learning ALOT! :eek:
 

Latest Posts

Back