If you install a Linux distribution, open-source Web servers, databases and scripting languages get installed with it and are up and running instantaneously. Contrary to the conventional belief that open source packages work only on Linux, they work as good on Windows too. But the abundance of documents and help from online communities available talk more about setting them on Linux than on Windows. For those who want to install them on
Windows, there is a freely downloadable installer called XAMPP.
XAMPP provides a simple, click and install, installer to set up Apache (a Web server), MySQL (a database server), PHP (server side scripting languages), Mercury (an SMTP server), FileZilla (an FTP Server) and some Web based administration tools. Besides these, it also installs SQLite (a flat file based database), eAccelerator (a caching engine to boost up the performance of PHP scripts,
phpMyAdmin (a Web-based front end to the MySQL database) and Webalizer (a Web-based package to analyze Apache logs)-effectively installing everything that you will need to develop and deploy an open source Web based project on Windows.
Installation
Download XAMPP from http://www.apachefriends.org/download.php?xampp-win32-1.4.13-installer.exe. Double click on the
installer and follow the onscreen instructions. Now you can launch the various services (Web, database, e-mail, etc), from its control panel. After installation, you can fire the control panel by clicking on Start>Programs>apachefriends>XAMPP>XAMPP control panel.
Apache-IIS blues
If on Windows, you are running IIS (Internet Information Services) server, you will not be able to launch Apache Web server. Notice that when you click on the Start button besides Apache on the XAMPP control panel, it will not start. This is because, by default, Apache runs on the standard Web server port, port 80, which would have been occupied by IIS. In this case, there are two ways to run Apache, either stop IIS or run Apache on a different port.
|
To stop IIS, click on Control Panel>Administrative Tools> Internet Information Services. Right click on the computer icon on the right pane and select All Tasks>Restart IIS. From the drop down select 'Stop Internet Services ...'. Subsequently, click on the Start
button besides Apache on the XAMPP control panel. You should be able to access the default website running on Apache by keying in the the URL
https://
Note the 'https' in the URL instead of http. Another goody from XMAPP, Apache is preconfigured for SSL (Secure Socket Layer).
To run apache on a different port, perform the following. Note that by default XAMPP gets installed in c:\apachefriends\xampp. If your case the drive letter or the installation path may be different so substitute it accordingly. We will call this
Substitute 8080 with your preferred port, to which Apache will listen to. On XAMPP Control, click on Start besides Apache. Now you can access the default website running on Apache by keying in https://
in your Web browser. To publish your own Web pages, drop in the pages in the directory
Switch between PHP 4 & 5
XAMPP bundles PHP 4 and well as PHP 5. By default, XAMPP will run PHP 5 (version 5.0.4) which is the bleeding edge. But it can also run PHP 4 (version 4.3.11). You can switch from one version of PHP to the other (for any specific need of yours) by using a utility called php-switch. But before using it, you must stop Apache through the XAMPP control panel. Then, go the directory
Those who have set Apache to run on a different code will have to tweak a line of code to make the switching work.This is because the php-switch.bat first detects whether Apache is running or not. If running, it gives up saying that first you will need to stop apache. And it always checks Apache on port 80. So in case you have a different Web server running on port 80, the php-switch.bat will complain. To fix this, open the file named php-switch.php found in the directory
if (($handle = @fsockopen($host, 80, $errno, $errstr, $timeout)) == true)
Here, replace 80 with the port you have set for Apache (8080 for us). Now double click on php-switch..bat. When you want to switch back to version 5, do the same, except that you press 5 after running
php-switch.bat.
Web Admin for MySQL
With phpMyAdmin, managing and issuing SQL queries against a MySQL database is quite intuitive and a newbie can easily get comfortable with it. Make sure you click on the Start button besides MySQL on the XAMPP control panel. Now, click on Window's Start>Programs>Accessories>Command Prompt and issue:
cd c:\apachefriends\xampp\mysql
mysql —u root
This will drop you onto the mysql> prompt. At this prompt issue:
use mysql;
delete from user where user='';
GRANT USAGE ON mysql.* TO 'pma'@'localhost' IDENTIFIED BY 'secret';
GRANT SELECT (
Host, User, Select_priv, Insert_priv, Update_priv, Delete_priv,
Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv,
File_priv, Grant_priv, References_priv, Index_priv, Alter_priv,
Show_db_priv, Super_priv, Create_tmp_table_priv, Lock_tables_priv,
Execute_priv, Repl_slave_priv, Repl_client_priv
) ON mysql.user TO 'pma'@'localhost';
GRANT SELECT ON mysql.db TO 'pma'@'localhost';
GRANT SELECT ON mysql.host TO 'pma'@'localhost';
GRANT SELECT (Host, Db, User, Table_name, Table_priv, Column_priv)
ON mysql.tables_priv TO 'pma'@'localhost';
quit
On the third line, substitute 'secret' with your own password to allow phpMyAdmin to connect to the MySQL database server. The 'quit' command will take out of the mysql> prompt. Now in the same directory, issue:
mysqladmin —u root password secret123
Substitute
$cfg<'Servers'><$i><'controlpass'> = '';
And change it to:
$cfg<'Servers'><$i><'controlpass'> = 'secret';
Note that 'secret' is the password for phpMyAdmin which we had setup above. Similarly find the first occurrence of the line '$cfg<'Servers'><$i><'password'> = '';' and change it to '$cfg<'Servers'><$i><'password'> = 'secret123';'.
Here secret123 is the password of the MySQL root user that was set up using mysqladmin. Save the file and key in the URL
https://
Shekhar Govindarajan IT4Enterprise