Having written many tutorials on how to configure web servers, write small programs, and how to troubleshoot software, I will tell you that this type of tutorial--one where I explain how to configure something on your computer--is by far my least favorite and most-dreaded type of tutorial. Programming can be frustrating, but the added burden of getting your development environment setup is sometimes enough to make you want to abandon the project completely. The following process may not take much time at all, but if your computer has an abnormal configuration or if you make a minor mistake, you may seriously consider just giving up. While I cannot stop you from moving onto something else entirely, I encourage you to push on should something go awry. While programming as a whole does not get easier along the way, I will be able to guide you through the rest of this tutorial series without too many bumps in the road.
PHP can be used in many different environments; however, it is primarily used in conjunction with a web server. It excels in dynamically generating both page content and the formatting markup for websites. Since PHP is most commonly used on the web, we will be learning to program web applications.
One day I was talking to a graduate student in Computer Science who made a snarky comment along the lines of "People who suck at programming end up making websites for the rest of their lives." If I had given his opinion any credence, I would have wanted to crawl into a ball and die for having spent seven years devoting my life to web programming. I'm glad I didn't do that, and hopefully, if you read through this series in its entirety, you will also see how web development is not only useful and rewarding, but also very enjoyable.
You have two choices.
Since we will be studying PHP as it was made for the internet, you have two options on how you will develop your programs. The first method is the easiest to setup, but can be a really big pain once you want to start testing examples. The second will be my recommended configuration, but it could possibly make
you want to crawl up into a ball and die.
Your first option is to use an existing web host on the internet. Obviously the host will need to have PHP support. There are many hosts available, both free and paid services, and it really doesn't matter who you choose. Since I don't recommend this method for testing your code, and since writing a thorough step-by-step tutorial on web hosting would take me days, I'm just going to mention that this option exists. How you go about finding a host and sending your files to the hosting account will be left up to you. Many tutorials already exist on the internet that can explain the process, and in many cases the host will have documentation or will be able to help you get started. Keep in mind that, if you go this route, you will need to be able to upload files to your account, and, as previously stated, the host will need to have PHP support. Ideally you will want PHP 5 support, but you can accomplish most of the early parts of this series with PHP 4. Your host will also have to have support for MySQL databases. While this is not 100% necessary to learn PHP, it is highly recommended that the host provides you with at least one MySQL database. Without a database you will not be able to take advantage of our database examples.
The second option is to setup a test environment on your computer. Let's take a look at how this is accomplished.