[PHP][MySQL][Apache][Windows] Home Server

Post all your tuts or request for tuts here.
User avatar
Chris
Posts: 1580
Joined: Wed Sep 30, 2009 7:22 pm

[PHP][MySQL][Apache][Windows] Home Server

Post by Chris »

I noticed that quite a lot of people actually use webhosts to test their sites. Erm sorry but isn't that awfully slow? Constantly uploading files, connecting to slow over used servers. Well why not just use your computer as a test server?

If you are running Windows. There's a very handy tool called WAMP(Windows Apache MySQL PHP). This little tool automatically sets up all the awkward stuff for you, it comes with PHPMyAdmin and has its very own easy to use PHP and Apache control panel.

Where to download.
http://www.wampserver.com/en/download.php

Once you have it downloaded, which should take less than a minute. Run it and install it. When installing it you will be asked to fill in some stuff. If you aren't sure what they are for, just leave it as it is.

Once installed start the program. If you use it quite a lot I recommend putting it in the list of programs that start when you boot up.

How to use this wonderfull tool.

After running the program, you might notice there is a new icon in the bottom right corner, with all the other notification icons. That may look something like this: Image. It may be slightly red or yellow.


When you click on that icon(left click) you will notice a sort of list will show up.
Image

Click on "Start All Services".

This will start, PHP, MySQL and Apache.

Give it a minute to start the services, then if you click on the "Localhost" link at the top, it will automatically open your browser and go to http://localhost/. This page is running from your computer :D.

So how do we start making our site?
By clicking on "www directory" in the wampserver menu, it will bring us to the www dirctory, this is where all your pages go. You may notice that there already is an index.php file. That is the page you get when you visit http://localhost/. If you don't want it you can delete it and you will get the default apache page, with all the directories and files in the www directory.


MySQL
by clicking "phpMyAdmin" in the wampserver menu, it will open PHPMyAdmin in your browser. :D simple as that.

If you didn't adjust anything while you were installing, your MySQL host will be "localhost", username "root" and you won't have any password. Note, phpMyAdmin can only be accessed by localhost.


Putting it all online.
This is handy if you ever want someone to test a site.

Not all ISP's(internet service providers) allow port 80 to be forewarded, so this may not work.

When running from home, I'm guessing you are behind a router. I will explain how to set up a static IP, open your NAT, and port forward 80.

I will explain this for most netgear routers. Other routers will probobally work along the same lines.

Okay, first things first. Let's get open the router admin.

Try going to 192.168.0.1, if that doesn't work try 192.168.1.1.

If it works, you may notice you are asked for a username and password.
Image
By default the username is "admin" and the password "password".
Image
Fill in the shit and press ok.

You will then probobally get a page checking for updates. If using netgear you will get a page that looks like this:
Image

In the navigation click "Attached Devices", on this page you will get a list of computers attached to your router. Ipods don't show up for reason :P
Image
You may have noticed I circled an IP, that is my static IP. 192.168.1.100. Every time I connect to the router I automatically get that ip. whereas if my brother connects, his could be 192.168.1.3 one time, and 192.168.1.4 the next.

Let's set up a static IP like mine.

Handy for me there's a site that explains exactly how to do this on different os's here's a link :D
http://www.portforward.com/networking/staticip.htm

Choose your operating system and follow the tutorial given.

Now we have our static IP set up let's port forward it and open our NAT

Port forwarding
Click on "Port fowarding/Port Triggering" in the navigaion.
Image
Fill in the required information:
service type: Port Forwarding
Service Name: HTTP (can always be changed)
if asked for start and ending port, both are 80
Server IP Address. The static IP address you just set up. in my case 192.168.1.100
Press "Add".

Opening your NAT
Click on "UPnP" in the navigation
Image
Check the "Turn UPnP On" box.

You might notice on my picture that there is a list of shit.. just ignore it. Yours will also fill up in time.

Finished with the router :D

Go back to your wampserver menu. And press "Put online".
Image

Type your static ip in the address bar of your borwser. in my case: http://192.168.1.100/ You should get the same page you get as when you got to http://localhost/(or http://127.0.0.1/ the exact same thing)
This means your port has been forwarded succesfully.

Now try go to your internet IP
if you aren't sure what it is go here http://www.moanmyip.com/

If you go there and it works. Your computer has successfully been made into a web server.

Hope you enjoyed the tutorial.
Last edited by Chris on Wed Nov 24, 2010 3:08 pm, edited 1 time in total.
Fighting for peace is declaring war on war. If you want peace be peaceful.
User avatar
OldRod
Posts: 1321
Joined: Sun Sep 20, 2009 4:26 pm

Re: [PHP][MySQL][Apache][Windows] Home Server

Post by OldRod »

Good stuff! I use WAMP too, but I put stuff online if I want others to test it. Good to know how I can do that from my own machine now :)

Thanks for posting this!
User avatar
hallsofvallhalla
Site Admin
Posts: 12031
Joined: Wed Apr 22, 2009 11:29 pm

Re: [PHP][MySQL][Apache][Windows] Home Server

Post by hallsofvallhalla »

yes I am going to set up a section on the main site for posts like these. Thanks!
Baseball435
Posts: 548
Joined: Sun May 30, 2010 3:49 am

Re: [PHP][MySQL][Apache][Windows] Home Server

Post by Baseball435 »

I know this is an old post but, can you make a .com, a .org, a .net etc with that?
User avatar
Noctrine
Posts: 928
Joined: Thu Apr 23, 2009 9:57 pm

Re: [PHP][MySQL][Apache][Windows] Home Server

Post by Noctrine »

You can, but since your home internet connection is more than likely on an ISPs dynamic IP it's ill advised. you would have to constantly update your DNS.

DynDNS may have a workaround for this, but it is sure to cost. From there, it may also be illegal due to your ISPs ToS.
Jesse Dorsey
ProjectANI - Lead Developer Person
http://about.me/jessedorsey
Falken
Posts: 438
Joined: Fri May 08, 2009 8:03 pm

Re: [PHP][MySQL][Apache][Windows] Home Server

Post by Falken »

Noctrine wrote:You can, but since your home internet connection is more than likely on an ISPs dynamic IP it's ill advised. you would have to constantly update your DNS.

DynDNS may have a workaround for this, but it is sure to cost. From there, it may also be illegal due to your ISPs ToS.
You can do it for free with DynDNS. Use their free service to get a url like: whatever.dyndns.org and then redirect your .com, .net or similair domain to that dyndns url instead ;)
--- Game Database ---
For all your game information needs!
Visit us at: http://www.gamedatabase.eu today!
Baseball435
Posts: 548
Joined: Sun May 30, 2010 3:49 am

Re: [PHP][MySQL][Apache][Windows] Home Server

Post by Baseball435 »

yeah but i mean like can you make your url, instead of your ip, a .com, like can you be your webhost like DynDNS is to other people?
Falken
Posts: 438
Joined: Fri May 08, 2009 8:03 pm

Re: [PHP][MySQL][Apache][Windows] Home Server

Post by Falken »

Baseball435 wrote:yeah but i mean like can you make your url, instead of your ip, a .com, like can you be your webhost like DynDNS is to other people?
Ye, you don't need to buy a webhost. You can buy ONLY the domain and domain service (which is making sure all root servers knows of that url) and choose to link that to any url or IP.
--- Game Database ---
For all your game information needs!
Visit us at: http://www.gamedatabase.eu today!
Baseball435
Posts: 548
Joined: Sun May 30, 2010 3:49 am

Re: [PHP][MySQL][Apache][Windows] Home Server

Post by Baseball435 »

Falken wrote:
Baseball435 wrote:yeah but i mean like can you make your url, instead of your ip, a .com, like can you be your webhost like DynDNS is to other people?
Ye, you don't need to buy a webhost. You can buy ONLY the domain and domain service (which is making sure all root servers knows of that url) and choose to link that to any url or IP.
yeah but like can you be your own domain service and give yourself your own domain instead of having to buy one?
Falken
Posts: 438
Joined: Fri May 08, 2009 8:03 pm

Re: [PHP][MySQL][Apache][Windows] Home Server

Post by Falken »

Baseball435 wrote:
Falken wrote:
Baseball435 wrote:yeah but i mean like can you make your url, instead of your ip, a .com, like can you be your webhost like DynDNS is to other people?
Ye, you don't need to buy a webhost. You can buy ONLY the domain and domain service (which is making sure all root servers knows of that url) and choose to link that to any url or IP.
yeah but like can you be your own domain service and give yourself your own domain instead of having to buy one?
technically yes, practically no :P

But it is often cheaper just to buy the domain instead of a webhost.

But you should not run a live project on wamp, got too many security issues.
--- Game Database ---
For all your game information needs!
Visit us at: http://www.gamedatabase.eu today!
Post Reply

Return to “Tutorials”