View Single Post
Old 16. Jun 2009, 11:44 PM   #10 (permalink)
George
Progradminstrateditor
 
George's Avatar
 
Join Date: Mar 2008
Location: Frankfurt, GER
Posts: 2,300
Default

Xampp (and the other packages mentioned here) is a collection of software that turns your local PC into a webserver. Xampp e.g. comes with Apache, PHP, MySql and some other server software. Once you have installed and started it, your PC is the webserver. You don't even need an Internet connection to work with it. You can develop your website completely locally. The link to your local webserver is "http://localhost".

Apache and PHP are interpreting your files. In my previous example the PHP code connects to your local database server (indicated by the first parameter of the function mysql_connect).
PHP Code:
$connection mysql_connect("localhost""myusername""mypassword"); 
After that it accesses a certain table and reads information from it. Then it prints the information. "Printing" in this case means that it prepares the html page code that will be sent to the requesting browser when the page is processed. The database server is returning the information to the PHP program that is asking for it.

Your hoster will provide an own webserver and database server for you. You don't need Xampp for running your web pages on your hosters sever. You only have to copy your html/php files to your hosters webserver (using an FTP program for example). Once you have copied your files there, the hosters server will run them when you point your browser to your domain.

When your files are executed on your hosters server, the address "localhost" is looking for a database server on the, as the name suggests, local host (your hosters server).

Sometimes hosters are installing database servers on different machines than the web server. In that case your hoster will tell you what the DB server address is, e.g. "db.hoster.com" or something like that. "Localhost" would not work in that case as you can imagine.

I personally develop my web applications locally first. When it runs fine on my computer I copy all files to my hosters webserver and see how it works there. Before I copy the files I change those files where I need to change addresses (like the address of the DB server).

There is a chance that your hoster is running different versions of PHP and MySQL. Sometimes that leads to errors or different results.

The advantage of developing locally first is that you don't have to upload each file after each change to test it. You also don't need an Internet connection so you can even develop on trains, planes and at other places where you do not have that access.

Your hoster will most probably provide you with an online access to your database so you can create your databases and tables. In many cases it is phpMyAdmin which also comes with Xampp. So you might already know how to work with it.
__________________
Best regards, George

Last edited by George; 16. Jun 2009 at 11:49 PM.
George is offline