PHP 101: Installing Apache with XAMPP for PHP

May 15th, 2007 by Justin Carmony

How to get started

So you want to be a web developer? Professional or as a hobby, PHP can be a fun experience. However, if you don't know where to start off, it can be a total pain in the butt and a huge headache. We hope to help give people a good shove off into PHP programming world. However, we want to avoid technical jargon (words) and keep it easy for gamers to understand.

In this tutorial we will accomplish the following:

  1. Get a basic understanding of what PHP does.
  2. Install software (XAMPP) to run a personal web server on your own machine.
  3. Learn how to make simple script files and where to save them.
  4. How to view your website.

What is PHP?

PHP stands for PHP: Hypertext Preprocessor. That is the only textbook thing you'll read in this tutorial (or so I hope). PHP is used to create dynamic websites, meaning that websites that can change the content it displays without a person changing it manually.

Websites are made using HTML. If you're looking for a good place to learn HTML, check out W3School's HTML Tutorial. However, there are limitations to HTML. HTML on its own can't access a database to get information, or HTML can't manage different sections on a website. HTML pages on their own are static (for the most part), non-changing.

So lets say you want to make a page that displays a person's name when they log in, and if its their birthday to display a message. You would do this using PHP. We'll explain later on.

Time to install!

Alright, you guys are 10 times luckier now than when I started PHP programming. I had to go out and install and configure Apache (the webserver), PHP (coding language), MySQL (database software), and any other extras I needed, like FTP, email, etc. Then I had to configure it all. If I did one thing out of step or configure incorrectly anything… it would explode and die on me.

However, three years ago I found this amazing program which is the best thing for easy web servers. It makes installing and coding on your computer a few clicks away. I would have killed (almost) to have had this. It is by Apache Friends, and its called XAMPP.

XAMPP Logo

!!!!!!!!!!!WARNING!!!!!!!!!!!

If you use Skype, close it before installing XAMPP. I don't know why, but Skype reserves port 80, which interferes with XAMPP.

Go to Apache Friend's website and go to XAMPP -> XAMPP for Windows -> Installer. Or, if you're lazy, just click here to download it.
XAMPP Download Page

After downloading the installer, run it. You'll see the following:
XAMPP Select Language

Select your language (I'll select English). Hit okay, you'll see this:
XAMPP Installation Intro

Just click Next. Now it will show your location. I'll be using the default.
XAMPP Installation Location

After clicking next, you'll see several options:
XAMPP Installation Options

Now, you can keep the defaults. If you want to install the Services you can. What that means is that in the background of your computer the programs for running a web server will always be on.

Go ahead and click next.
XAMPP Installing

Its going to install the needed stuff. If it install successfully, it will show this:
XAMPP Installation Successful

Click finish.

Now that XAMPP is installed, the web server stuff isn't started on your machine yet. To do that go to Programs -> Apache Friends -> XAMPP -> Control Panel. Or click the link on your desktop. It will open a window like this:
XAMPP Control Panel

Here is what each of these programs do:

  • Apache - The Website Server for your computer. If this is off, you can't view your sample code. This will be needed for this tutorial
  • MySql - The Database for your computer. If this is off, you won't be able to have your site access a database. This won't be used in this tutorial, but it will in future tutorials.
  • FileZilla - A FTP server. This won't ever be used in one of our tutorials.
  • Mercury - a Mail Server - this won't ever be used in one of our tutorials.

Lets start Apache and MySQL. Click the start buttons for each. When they are started it should look like this:

XAMPP Control Panel Started

If Apache or MySQL won't run, it means something is using the those ports (they are 80,443, and 3066).

Now your have a web server running on your computer. Congratulations!

Making a PHP script

Now lets make your very first script! First, I would download a program called Notepad2. It’s a very lightweight text editor that highlights text according to what it is. Now create a new document and past the following code in your editor:

PHP:
  1. <?
  2.  
  3. echo "Hello World!";
  4.  
  5. ?>

After you enter that into Notepad2, save it to "C:\Program Files\xampp\htdocs\test.php"

After saving, In notepad 2 it should look something like this:
Notepad2 & PHP

Viewing your website

Now, go ahead and open FireFox or Internet Explorer and in your address bar type this:

http://localhost/test.php

You should see this:
XAMPP Control Panel

Congratulations! You're ready to start programming in PHP!

That’s the end of our article for today. However, if you're interested in learning more about PHP now, I'll give you some links for good beginner tutorials.

Tutorials

W3Schools HTML Tutorial - http://www.w3schools.com/html/default.asp
W3Schools PHP Tutorial - http://www.w3schools.com/php/default.asp
Zitag PHP Tutorial - http://www.tizag.com/phpT/

Coming Up Next

Next tutorial we'll teach you the very basics of PHP, in many ways the things covered in the tutorials above. Hopefully it will be out by next week.

Questions

Q: Do you seriously use the default background for Windows XP and you use the Classic Theme (aka ugly windows 98 look?)
A: I have two installations of Windows XP on my computer. One for work (programming, web development, etc) and one for gaming. I have over 5 different IDE (Integrated Development Environment, aka Visual Studio, Zend Studio), 4 different databases, 3 types of web servers, and tons of other utilities for programming installed on my work machine, not to mention my virtual servers I use for testing. In short my "work" installation of XP is overloading with crap, and I don't need anything else using more resources. Besides, if you work a lot with Windows Server 2003, you get used to the look.

Q: How long do you think it will take me to learn PHP?
A: Well, depends on what you call "learn". If you have previous experience with programming (like in C++, Java, VB) it will take a few weeks to get the principles down and understand how PHP works. To fully master PHP, never. There is always more to know. PHP is very powerful and neither Eric Ping or I (Justin Carmony) know everything. There are a lot of features we haven't even explored yet.

If you have any questions or comments, please feel free to leave a comment or email us at devzone@cevolved.com.

30 Responses to “PHP 101: Installing Apache with XAMPP for PHP”

  1. Justin Carmony Says:

    Testing the comment system.

  2. Justin Carmony Says:

    Second Test, checking color switching rows.

  3. fleitas Says:

    might want to change the footer unless this blog is for web design about traveling seo and concerts?

  4. Justin Carmony Says:

    lol, my fellow spanish speaker, I’ll get right on it ;)

    Justin

  5. CEVO Developer’s Zone » PHP Video Tutorial - The Basics Part 1 Says:

    […] test web server. If you don’t know what I’m talking about, then follow this tutorial on how to install XAMPP on your PC, which will allow you to run php websites right off from your PC. We will be using Notepad2 to do […]

  6. miguel espende Says:

    i had a hard time running xampp’s apache on windows 2003 server….

  7. Miguel Espende (another) Says:

    Hi, I need the email of “Miguel Espende” please, what can I do?. I’m don’t speak english, I speack spanish. Thanks.

  8. wireless computer network Says:

    I suppose I’m gonna have to read up some more but this is a really good spring board.

  9. niche keywords guide Says:

    Awesome remark about google. I’m frankly incredibly flabbergasted that it hasn’t been enunciated earlier to such great lengths.

  10. Echo Vanderwerff Says:

    Hi Guys ! Let see this, i found it minuts ago, it’s totally crazy, an online free flash web editor that permits you to create a website for free with no programming skills ! create a free flash website

  11. Nike Air Max Says:

    having a useful information. Thanks a lot!

  12. Nancy Clenney Says:

    Great writing. I appreciate you for posting it. Keep up the fine work.

  13. Felisha Frances Says:

    Protect your assets with WiredTree.com Server Shield, free to all clients.

  14. Hannah Gutschow Says:

    No comments, let see this video, it talks by itself create a free flash website

  15. Nike Air Max Says:

    Best wishes!Your blog is very good!

  16. Korey Raimondo Says:

    Wooooooow let see this friends designers, a free online flash web builder requiring nor programming skills at all ! how to create a website or blog

  17. reverse phone detective Says:

    Sweet, finally a post that fulfills my research. So many people get this topic wrong. You are a great thinker.

  18. bookmarking demon review Says:

    the best idea is 100% content. Use content when you do your promotions. You

  19. Nike Air Max Says:

    Very creative, one of the nicer sites I have seen today. Keep up the great work.

  20. Wilton Mcfarlain Says:

    I found this great SEO assistance today and thought i will reveal it over here

  21. Danielle Giebler Says:

    If yu are looking for a very comprehencive SEO analysis of your website then you want to check out this incredible offer here http://www.bh-server.com/seo

  22. Marge Kempton Says:

    Hey guys, I heard that a company that helps you to create any of your programming ideas for peanuts ! programming outsourcing . As I heard, this company will help peoples getting top quality programmers for real affordable prices making everyone able to launch his IT startup !! So nice !

  23. myspace poker chips Says:

    i wouldn’t have believed this was trendy a number years ago nevertheless its interesting the way age adjusts the means by which you experience a variety of creative ideas, many thanks regarding the write-up it’s nice to look over anything intelligent once in a while instead of the regular nonsense mascarading as a blog on the web, cheers

  24. Lawrence Herandez Says:

    Hey web entrepreneurs ! You have great ideas and are looking for the best value coding company and/or looking for investors to help you fund your project? Just enter this place, I found it days ago, it seems to be in alpha but the concept seems really good ! CODINGATE .

  25. Joshua Johnson Says:

    Proficient blog! I’ll probably be citing some of this info in my next assignment.

  26. Eneida Specking Says:

    A good tester will have a systematic approach to testing that they can hold to any recognized scenario without reluctance. The one I got many another moons previous was to document the runs for pulling out a can from a lemonade vending machine. I did the total requirements, probed the testing environment, checked the machine was fit for testing and commenced the “tests”. Put in too little money, make money repaid, put in correct money, have money given back etc. Then when I did finally press vend, the can got stuck instead of falling to the tray. So I implemented the “workaround” of shaking the machine with my shoulder. My report concluded that the machine was periodically unfit for use unless a physio could also be installed in the building to deal with the multiple sore shoulders that would result from its implementation.

  27. Rusty Kinsolving Says:

    Great info! I recently came across your blog and have been reading along. I thought I would leave my first comment. I don

  28. Maurice Bramhall Says:

    Great info! I recently came across your blog and have been reading along. I thought I would leave my first comment. I don

Leave a Reply

Powered by WP Hashcash