In this tutorial I will introduce you about XAMPP, a bundle of apache http server, mysql database, php and perl script language from apachefriends.org.
XAMPP also include some usefull packages, such:
- ProFTPD 1.3.1
- PhpMyAdmin 2.11.3
- OpenSSL 0.9.8e
- Webalizer 2.01
- IMAP C-Client 2004e
- OpenLDAP (client) 2.3.11
- SQLite 2.8.17 (for PHP4 + PHP5)
- SQLite 3.3.17 (for PHP5 PDO SQLite)
- phpSQLiteAdmin 0.2
- FPDF 1.53
Usually we need XAMPP to running our website in our home pc, not in paid server outside. So, we able to developing our website in our home offline before we upload it to online web server.
XAMPP available for many platforms, it available for Windows, MacOS and offcourse, Linux – no matter what distro you use. But in this tutorial, I will limit the tutorial in LAMPP (L stand for Linux!) only.
How To Install XAMPP/LAMPP
Download the latest LAMPP packages from http://apachefriends.org. Extract it to /opt directory as root or if you want easy to configure it, just uncompress it in your home directory.
sudo tar xvzf lampp-xxx.tar.gz /opt
Here I use sudo to doing something with root privilege. If your distro not support sudo by default like Ubuntu, issue su command before then enter your root password.
I myself, extract the lampp packages in my home directory on special website folder. If you take this way, follow me:
tar xvzf lampp-xxx.tar.gz /home/amrinz/website
and as root, we make a symbolic link (symlink/shorcut) and put it in /opt.
ln -s /home/amrinz/website/lampp /opt/lampp
Now we have finished installing XAMPP/LAMPP. Next we will learn how to use XAMPP/LAMPP.
To access your web server, you must start it first. The XAMPP command formated like this:
For example, use this command to start XAMPP, as root.
sudo /opt/lampp/lampp start
and to stop it, use this command
sudo /opt/lampp/lampp stop
and also some sets of actions you can use:
Start XAMPP (Apache, MySQL and eventually others)
Start only Apache
Start only SSL support
Start only MySQL
Start only ProFTPD
Stop only Apache
Stop only SSL support
Stop only MySQL
Stop only ProFTPD
Reload XAMPP (Apache, MySQL and eventually others)
Reload only Apache
Reload only MySQL
Reload only ProFTPD
Stop and start XAMPP
Check XAMPP’s security
Which version of PHP is active?
Make backup file of your XAMPP config, log and data files
Starts graphical XAMPP control panel
To test if your installation succesfull, after start the XAMPP, acces http://localhost through your web browser. You will see the XAMPP greet!
To acces another feature of XAMPP, such phpmyadmin, call it from your web browser in this url, http://localhost/phpmyadmin
To change the http://localhost content, go to /opt/lampp/htdocs, delete all files and directories there and change it with yours.
How To Create XAMPP Virtual Host
In this part, I will explain how to create apache virtual host.
Virtual host is apache feature which allow us to make our website with it own domain. So we can access our website through “real” url.
For example, we will make a virtual host for www.berugak.com domain.
If you installing lampp in /opt you need, again, root privilege to edit /opt/lampp/etc/httpd.conf file.
Just add this line in the last file:
and now, as regular user, open your editor, add these lines:
Save this file as extra-httpd.conf in /home/username/website, as we define in httpd.conf file.
Then, we must add the IP address we use above to /etc/hosts file. Just add:
In Ubuntu, you can use the Network menu. Go to System >> Administration >> Network.
Change the tab to Hosts, click Add, enter the IP address and the server name.
The last step is to create the berugak.com folder, in /home/username/website and put it with files.
You can access the new virtual host in http://www.berugak.com url, as the real online website!
If you want add more virtual host, just repeat the last three steps above by changing the IP address, the server name and the directory location/name.
Mmmm, I think that enough for now. Happy dance!