Setting up a Test Server on Your Own Computer



Get Web Design Tips and Tricks on mps-web-design.com. Setting up a Test Server on Your Own Computer topic will increase your understanding on Web Design Tips and Tricks. We at mps-web-design.com only provide news, articles, information in Web Design Tips and Tricks. Web Design Tips and Tricks at mps-web-design.com provides the most up to date news and articles. If you have questions please do not hesitate to contact us.

When you're developing a website, you need to see it in action on a real server, to see how it will work. While you could upload your pages to your web host every time you make a change, this quickly gets time-consuming and tiresome. Wouldn't it be great if you could have a little test server of your own? Well, the server is nothing but a piece of software - so you can! Please note that, for the purposes of this article, I will assume you're using Windows as your operating system.

Installing an IIS Test Server

While using IIS isn't recommended, a test server is very easy to install. All you need to do is open 'Add or Remove Programs' in Windows' control panel. All you need to do is click Internet Information Services (IIS), click OK, and you're done.

Of course, there are downsides to this. Many versions of Windows don't come with IIS, and there's no way to install it on them - Windows XP Professional, for example, comes with IIS, but Windows XP Home does not. You might also want to consider that installing IIS on your computer will often make it less secure.

Installing an Apache Test Server

Compared to installing IIS, installing Apache is hard - Linux distributions all have relatively easy ways of doing it, but Windows wasn't designed for it. To get Apache installed, then, you're going to need to have a little fight with the system.

Note: If you want to skip all the following steps, you might consider using an 'easy installer' version of Apache, such as XAMPP (for Windows), which you can get at www.apachefriends.org/en/xampp-windows.html. The downside to this approach is that you will be relying on them to provide new releases, instead of being able to update things yourself.

First of all, download Apache from http://httpd.apache.org/download.cgi. Make sure you download the Windows Installer (MSI) version. You'll find it easiest to make the server run as a service, as this will make it run automatically - Apache will appear in your system tray (in the bottom-right corner of your screen).

Now, you need to find your Apache configuration file. In the folder where you installed Apache, look for another folder named 'conf', and then a file named 'httpd.conf'. Open this file and look for a setting called DocumentRoot. You should change this to point to a folder on your hard drive, such as 'c:/html'.

Now, you've got Apache, but that's not usually much good on its own. The chances are that you'll want to install PHP and MySQL as well, so here's how:

Download PHP from http://www.php.net/downloads.php. Again, go for the installer. Once you've installed PHP, find its folder, and rename the php.ini-dist file there to php.ini. Find the 'doc_root' setting there, and set it to the same thing you set Apache's to.

Back in Apache's httpd.conf, you should add these lines:

LoadModule php5_module 'c:/php/php5apache2.dll' AddType application/x-httpd-php .php PHPIniDir 'c:/php'

If you didn't install PHP in c:php, change the lines above to reflect where you put it.

Now, installing MySQL isn't as difficult, because it runs independently of your Apache configuration. Download MySQL from dev.mysql.com/downloads. Again, get the Windows installer version. This installer has a lot of settings, but you'll be fine if you just click Next through them to accept all the defaults.

The only remaining step is to enable MySQL support in PHP. Copy libmysql.dll file from c:php to your WindowsSystem32 folder, and then open the php.ini file you created before. Remove the semicolon from the start of the line that says ';extension=php_mysql.dll', and save the file.

Shut down Apache and restart it, and you're done!

Visiting Your Server

When they've installed a server on their computer, many people wonder how they can access the server they just installed as if they were visiting it over the web. The answer is simple: just open your web browser, and go to this URL: http://localhost (you can also use http://127.0.0.1). This special address means 'the server on this computer'.

You'll know if you installed Apache successfully because you'll see a page congratulating you. When you change your web pages, just use your browser's Refresh button to see the effect.


WebMaster Media Maker. - Create Streaming Audio and Video with Media players that do not require a streaming media server.
DesktopMaster 2.0. - Enjoy the newest desktop themes And keep your computer clean! DesktopMaster is the #1 Software for your desktop themes!

Firing a function from your browser

The concept is as simple as firing a function from your browser, and it leans on PHP's call_user_func_array.

I'm going to outline the concept as I have implemented it. This exact implementation may not work in your case, but perhaps you can adapt it to do so.

if(isset($_GET['f']) && function_exists($_GET['f'])) {
$func = $_GET['f']; // Get function name.
unset($_GET['f']); // Drop function from from get.
// Fire and print function, passing 
// remaining GETs as function parameters.	
print_r(call_user_func_array($func, $_GET)); 
exit;
}

In our CMS/Framework, we set up a controller with the code from above to respond at a given URL, for example http://www.example.com/__FOO. By passing a function name as a GET variable, in this case 'f', and the parameters necessary for that function to work as subsequent GET parameters, the result of that function will be printed to the screen.

So, http://www.example.com/__FOO?f=hello_foo&a=world would fire the function hello_foo('world'), perhaps printing Hello World! to the screen.

This allows for a quick and dirty test of a given function, and can be done remotely on a live site, if necessary, without touching any files or whatnot.

We hide this behind an authorization wall and also clean our parameters before they get to this level, so if you try this, keep these points in mind.



Article Index: | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79


More Articles:


1. User Experience - a new buzz word or the way forward for web development?
User experience might sound like just another bit of marketing candy, but there's a lot of science hiding behind this feel good phrase. People always come to a web site with a goal in mind, whether that's to book tickets, find out when the local recycle centre is open, check their bank statement or listen to the radio. It sounds remarkably simple, a logical assertion that the purpose of any web site is to fulfil the goals of the user. But time and time again, this fundamental concept is overlook…

2. Creating Effective Landing Pages By Jason DeVelvis
Landing pages are meant to convince your visitor to take a specific action. If the majority of your visitors are not taking the action that you wanted them to take, then your landing pages are not effective. Ideally, you should create several landing pages and determine which one is converting better. Once you know what is working, you can ditch the other pages – but in order to find out which one wins, you will have to run several test promotions, or one promotion with different links.Start b…

3. LET YOUR WEBSITE DO YOUR TALKING - How To Convert Your Voice To RealAudio On The Fly!
Have you ever wondered what it would take to quicklyget your own voice file onto your website?* How to greet your customers in your own voice. Let them get to know you; trust you.* Have an excited customer tell a testimonial about your service. Capture that 'story from the heart'!* Are you selling sound on your site? How to put your custom-made audio clip on your website in an instance?This easy three-step process will give your site that personal touch. That caring image. An interactive website…

4. A Website Checklist By Jane McLain
If you've just finished building your new website (or revamping your old one), how can you be sure it's "ready for prime time"? Or maybe your site's been around for awhile and you think it may be due for a makeover. Because Web technologies, techniques and standards change so rapidly, even a website that seems "cutting edge" when it's built can look obsolete a year later. Or maybe you started out with a barebones website and finally have the time and/or money to take it to the next level. If y…