Saturday, October 27, 2007

Setting up XAMPP for LAMP Development on Windows

Out of several LAMP/WAMP stack packages available in the market I prefer XAMPP from when Working on a Windows machine for my Development Environment.

The XAMPP for Windows can be downloaded from the following link

I download/keep the zip archive of the Basic package XAMPP Windows 1.6.4 which has the following components

Apache HTTPD 2.2.6, MySQL 5.0.45, PHP 5.2.4 + 4.4.7 + PEAR + Switch, MiniPerl 5.8.7, Openssl 0.9.8e, PHPMyAdmin 2.11.1, XAMPP Control Panel 2.5, Webalizer 2.01-10, Mercury Mail Transport System v4.01a, FileZilla FTP Server 0.9.23, SQLite 2.8.15, ADODB 4.94, Zend Optimizer 3.3.0, XAMPP Security, Ming. For Windows 98, 2000, XP.

After downloading it if you unzip the archive you will get a folder structure something like the following
Copy the XAMPP folder to the root of any Drive (Its not really required but to avaoid any hassle I recommend that you copy it to the Local Drive root and avoid spaces in any of the paths to all executables)

You can run the Server in many ways. I am going to describe some of them here.

Note: Before proceeding you need to make sure that the default Ports for the Servers that you wish to run or install are free. You can check this by running the Executable file ./xampp/xampp-portcheck.exe This will tell you whether the ports are free or not. if any of the port numbers 80(for HTTP Server) and 443(for HTTPS Server) is not free you will either need to stop/disable the Application that is running on this port or you will need to configure the Apache Server to run on some other port.

To change the default HTTP Port 80 for Apache open the config file ./xampp/apache/conf/httpd.conf in a text editor and replace all occurances of 80 to the new Port (Which should again obviously be free).
If you need to change the port 443 then open the file ./xampp/apache/conf/extra/httpd-ssl.conf and replace the occurances of 443 with the new port.

Similarly to run MySQL on a different port you will need to make changes in the file ./xampp/my.ini by replacing the default Port number 3306 with some other free valid port number.

If you are not a hard core LAMP Developer and going to have to run the server only occasionally You can start the Apache Server by executing the Batch file ./xampp/apache_start.bat in the root XAMPP folder. and to run the MySQL server run the Batch file ./xampp/mysql_start.bat

You should be all set to run your applications. Copy Your Applications directory to ./xampp/htdocs/MyAPP/* and you can access the Application with a url http://localhost/MyApp and http://localhost/MyApp/*

But this scheme has a drawback that you cat close the dos window unless you want to stop the Servers. To do so you have to run the Batch files ./xampp/apache_stop.bat
and ./xampp/mysql_stop.bat to stop them.

XAMPP Provides a Control Panel which is a file named ./xampp/xampp-control.exe if you run it you will get a User interface as in the following screenshot

You can simply Start and Stop by clicking the button with appropriate label beside each service. Bothe Servers are in running mode in the above Screen shot. so you don't see the Button labeled Start here.

This scheme is very cool but if you are a hard code developer and will need the Server running all the time then probably you wouldn't want to have to start the Servers manually each time you boot your System.

You can install the Servers as a Windows Server by clicking on the checkbox beside the respective Server. Make sure to stop the Server you are installing as a Service before checking the checkbox to install it.You will be prompted to confirm if you really want to install it as a service. It will be installed if you confirm by clicking the button labeled "OK" Once the Service is installed you can start the Servers manually by clicking on the Start button here for the first and last time.

Note: If you have the XAMPP folder in D and select the Service option then you will have to run the Script .xampp/setup_xampp.bat before proceeding because of some bug in this version (not sure about other versions.).

You should be all set now. next time you boot the System both the Servers will be started automatically.


Happy Developing on LAMP/WAMP ...

1 comment:

rize wordpress said...

Website serves as a way of marketing products or services sold to businesses and the visibility of your business increases, you must appoint a PHP development company. Do you think the web application