Introduction to the Xampp local server
Xampp is an acronym, where the X could be any of the letters W, L or M. In fact Xamp is an acronym for:
- Lamp (Linux, Apache, MySQL, PHP, Perl)
- Mamp (Mac, Apache … etc.)
- Wamp (Windows … etc.)
When Xampp is installed on a computer, you can run a webserver from it. The files stored in the folder
- htdocs
will be shared on the local area network.
Installing Xampp
In the class we’ll probably have many operative systems present, like Windows, OS X, Unix and Linux. Here are some introductions for instaling Xampp on these operative systems. Let’s try it out in HTML.
- Create a folder in htdocs. Name i helloworld or similar.
- In the folder create a and name it: index.htm
- Copy the code below and paste the code into index.htm.
Windows 8
Mac Os
Linux (Ubuntu)
How to use Xampp
During the first semester at the Multimedia Designer and Communication Programme you’ll work with more or less static webpages. So in the beginning all you have to know is how start and stop Xampp – and where to store your files.
Have a look at the relevant FAQ (Frequently Asked Questions):
Where to store your webpages
Xampp stores the webfolders in a folder named
- htdocs
Here you can create new folders for your webpages. In general it’s a good idea to have a folder for each project.
Folder Write Permissions
Try to create a folder in htdocs. Perhaps the folder is protected. If it is you have two options:
- Create a folder as administrator and do whatever operations you’d like to do in the folder with your administrator account (Windows users may log on as administrators, Mac OSX and Linux users should be root (or sudo).
- Or change the permissions of the folder, so that your user is permitted to use that folder.
Since this server is meant for your personal use, and since we do not intend to open up this server to the word wide web a simple work around is to create a folder via Filezilla. Change the permissions to 777 for the folder and subfolders.
Filezilla
The ftp client Filezilla is comparatively easy to use for transfering files from a local drive to an online server. You can also use it on your own system.
The Hello World Experience
It’s the classic test for almost any programming language. If you can write “Hello World” to the screen in a given app – you’re on the path to enlightenment.
- In htdocs create the folder helloworld
- Open the folder helloworld.
- In the folder create a file index.htm
- Open the file index.htm in an editor
The editors name is not important. But if you ask me: the simpler the better.
The index.html should look like this file: helloWorld.htm.
The Ultimate Test
Now let’s see if your work is crowned with success. Open a browser in:
- http://localhost/helloworld/index.htm
- or alternatively http://localhost/yourDirectory/yourFileName.htm
If there’s a big hello world in the browser window, it’s a smashing success.
Mail on Xampp
Sending an email by PHP is relatively easy, however you may have to configure the php.ini.
Linux users may have to install sendmail:
# sudo apt-get install sendmail
In php the send mail code may look like this:
$to = “your@email.com”;
$subject = “The subject text”;
$message = “The message….”;
$header = “From:abc@somedomain.com \r\n”;
$retval = mail ($to,$subject,$message,$header);
if( $retval == true )
{
echo “Message sent successfully…”;
}
else
{
echo “Message could not be sent…”;
}