Saturday, January 7, 2012

A very own Apache server with MySql/Php/Perl + more

Ever wanted your own apache server with MySql/Php/Perl/Etc..? Maybe for your website development test environment or just a general use apache server for sharing files with friends/colleagues? XAMPP offers just that, with an easy installation and configuration, taking a few clicks at most. I found this bundle very useful even when flashing STBs/Router's, as I could download required packages from my own apache server.

It is possible to install different modules (MySql, Apache, FileZilla, Mercury) as services, meaning they will start up automatically on system boot - which is great but presents a possible security issue. Be sure to change default passwords and consider disabling features you do not need (meaning, do not install them as services in the first place).

Your apache server is accessible over a web-browser typing the following:

http://localhost/

*Note: localhost is same as 127.0.0.1, as long as you did not change your loopback address. If you left your hosts file untouched, localhost will work just fine.

The following will open XAMPP's default Administration panel, where you can check a number of settings - Security and Status will probably be your first choice after installation. Placing files under <path_to_xampp_installation>/htdocs will make them available for download or make it visible, if the files represent a website.

http://localhost/xampp


So, for example, if you coded a webpage and named it mypage.html, then placed it in the htdocs folder, it will be available via browser at http://localhost/mypage.html .

XAMPP is also excellent for those that wish to learn/practice MySql syntax. Start-up MySql and either use provided web based client phpMyAdmin or run the sql command line (mysql.exe) under <xampp_folder>/mysql/bin . Use the windows native command prompt to run it by entering the following (be sure to swap the <xampp_folder> with the actual path - usually it is c:\xampp):

<xampp_folder>\mysql\bin\mysql.exe -u root -p

(-u meaning username, root being the username and -p stating you will be typing in a password)
Then type in your password and voila, you are in the MySql shell.

I suggest you make a simple script that will make this a one click procedure.
Open up notepad and type in the following:

@echo off
<xampp_folder>\mysql\bin\mysql.exe -u root -p

Save it as .bat file (be sure to select "Any" under "File type"). Place this script on desktop and run it when MySql is actually started. (check your XAMPP Control Panel to see if it is "Running")
If Firewall starts to complain, be sure to allow XAMPP and its components.



Linux procedure is fairly similar, but I suggest you use LAMP instead. I will write an extensive guide in another blog entry.

Taken from their website: 
XAMPP is an easy to install Apache distribution containing MySQL, PHP and Perl. XAMPP is really very easy to install and to use - just download, extract and start.
You can get it from http://www.apachefriends.org/en/xampp.html

3 comments: