Learning PHP


#1

I want to work my way through the tutorials at Zend Development Zone (PHP 101: PHP For the Absolute Beginner) but I don’t even know how to get to the place where I can enter PHP commands like the ever popular “hello world.”

If my domain is www.myhomebuiltplane.com, my MySQL hostname is mysql.myhomebuiltplane.com and my database is “homebuilt,” how would I start?

Thankfully this is a beginner’s forum, because I need it!


#2

In the simplest case:

You start by finding yourself a good editor. This can be an editor that runs on your own computer, or you can use one of the many editors that are supplied in the shell as part of your DreamHost account. If you use editor that runs on your own computer, it is helpful if you select one that allows you to save your files with “unix- style line endings”.

PHP code is created in an editor and saved as a file. Name the file “something.php” and place that file in a web-accessible directory of your domain. If you created the file on the server in the shell, you can just create it in the appropriate place; if you created it on your own computer, you will need to to transfer it via an FTP program to the appropriate place on your web server. From the information you gave above, that would be in the “myhomebuiltplane.com” directory of your DreamHost account space (or a directory beneath that).

Assuming you now have simple.php" in your user directory “myhomebuiltplane.com” (which is in the files system at DreamHost as /home/yourusername/myhomebuiltplane.com/), you execute the PHP code by browsing with a web browser to “http://myhombuiltplane.com/simple.php”.

When you do this, the PHP code in that file will be executed (the php statements in the file you saved will be read and actions taken) and, depending upon what those statements were, output will be sent to the browser, data may be added to the database, files may be created/deleted, and so on …

That’s the basic idea!

–rlparker


#3

You can start out by just using wordpad or notepad. Just rename the file’s extention. As a warning if you do use wordpad, make sure you save as a text document, don’t use the others. The file must be a plaint text file with no formating.
Example: If your file was saved as example.txt rename it to example.php

Some of your better editors like dreamweaver have some of the php commands at your disposal, which can make it easier to learn.

The php manual is a great resource PHP Manual

Amazon has a large selection of books as well.
Silk

My website


#4

You can find a good primer to PHP in our very own wiki: http://wiki.dreamhost.com/PHP

si-blog
Max discount on any plan with promocode SCJESSEYTOTAL