How to Make a Website: Part 2
Series: How to Make a Website
So you’ve enabled your computer’s secret ability to be an Internet. Big deal! What do you do with that puny little Internet of yours? You make a website, of course! Ok, then, off you go; go have some website. What, you still don’t know how to website?
Oh, right, that’s what I’m trying to teach you. Well, we had better get started, then.
Part 2: PHP Doesn’t Stand For Anything
We have to start with a bit of a lecture, I’m afraid. Essentially, the Internet is made up of two types of computers - servers and clients. Your computer’s browser is a client. It connects to websites and downloads HyperText Markup Language (that’s what HTML stands for) so you can read about celebrities and check Facebook statuses. A server compiles lots of code and does all sorts of magic on it before sending it out to the client as HTML. As you might imagine, there are therefore two basic types of programming for the Internet - server-side and client-side. The end goal of all web programming, whether on the client or the server, is to generate certain HTML markup for the browser to display. For the most part, then, all languages for making websites are designed to wrangle data somehow, turn it into HTML somehow, and send it to the browser somehow. This is about as basic as I can be without just saying “ELECTROBOX DO MAGIC.”
One popular client-side programming language is called Javascript (it’s actually a scripting language, but we don’t need to get that specific). A popular server-side programming language is called PHP (again, it’s a scripting language, but whatever). Neither is better or worse, they have very important strengths and weaknesses and are used for very specific and different things. How this matters to you is that you need to configure your new web server to handle the server-side technologies that you’re going to throw at it. Since client-side stuff doesn’t happen on the server, your server could not possibly care less about it. By default, Microsoft’s web server technology (IIS) doesn’t know how to deal with PHP, so we need to tell it what’s up.





fastcgi.inpersonate = 1
fastcgi.logging = 0
cgi.fix_pathinfo = 1
cgi.force_redirect = 0
If you are a wimp or something, you can just download the php.ini file I prepared for this tutorial and put it in your C:/php folder (make sure to rename it “php.ini” too). It is for PHP version 5.4.2, but it will probably work for any version 5.whatever.whatever.




Request path: *.php
Module: FastCgiModule
Executable: C:phpphp-cgi.exe (either type it in or hit the “OK” button - but make sure you switch it from .dll files to .exe files when you’re looking for a file to open)
Name: PHP_via_FastCGI



Okay, so PHP should be working on your Internet, now. The last thing we’ll do is create the world’s easiest web page to test that out.





You’ve actually done quite a bit just now. First, you installed PHP on your computer, and then you set up your computer’s web server to properly use it when somebody accesses a PHP file. You then created a new file that calls a special function in PHP which poops out a bunch of info about your computer’s version of PHP.
A website is just a directory on a computer somewhere. Your new “Default Web Site” is just a folder on your computer (“C:inetpubwwwroot” by default). Any files inside that folder will be accessible when you go to “localhost” in a browser, and the server will handle it a different way depending on what kind of file it is. When you tell the browser to open “index.php” (which it does by default when you don’t give it a specific file to open - remember when you told it to do that?), it sends a request to the server for that file. The server is all, “woah, that’s a PHP file, brah” (because you told it that all files with a .php extension are special files in the Handler Mapping, and your computer is apparently kind of a d-bag) and it opens the file with “php-cgi.exe” just like you told it to.
PHP and your computer compile the code in the file into delicious beeps and boops, and then process those beeps and boops however they’re designed to be processed. In this case, you’ve used the function “phpinfo()” which simply creates this cool little list of all the stuff that’s going on in your server, PHP-wise. You computer compiled your script, and the PHP files you installed processed that function into a bunch of Hypertext which get sent along to your browser. All that stuff happened the instant you hit “enter” in your browser’s address bar! Neat!

Try right clicking on the page and select “View Source.” Look at all that code that your little web server sent to your browser! That shows the power of server-side technology like PHP. The actual code for the page is only one function - “phpinfo()” - but the code sent to the browser is vastly different. This is only scratching the surface of what you can do with server-side scripting in PHP.
So now we’re one step closer to a super cool website, and now you have a really great development platform for playing around with PHP (among other things). Tomorrow I’ll be back here with another important step in getting your computer ready to be a super cool Internet, and then we’ll get on with doing a website - I promise. Before you know it, you’ll be able to website like a champ.
Related Reading
In the meanwhile, if you’re interested in learning a bit more about client- and server-side languages, there are some great resources online for you to check out. You won't need to know any of this stuff to complete my tutorial, but it's all very important stuff to know if you want to really get into doing websites. Feel free to create more files in your Default Web Site to practice any of this stuff, and bask in how genuinely cool what you're doing actually is.
- First, you should get the basics of HTML, so you can understand how a website is really made. (HTML Tutorial)
- Next you can play around with client-side scripting in Javascript. (Javascript Tutorial)
- Finally, why not play around with some PHP on your new development platform? (PHP Tutorial)
