OpenSource For You

Let's WAMP Up!

Close on the heels of the LAMP developmen­t platform is WAMP. Read on to learn the right steps to install and set it up. This article also outlines a few of the typical problems faced and offers some troublesho­oting tips.

-

LAMm (Linux, Apache, MySnL and mHm) is a very popular developmen­t platform in the open source world. Many mission critical websites are developed on this platform to leverage the best of the three open source technologi­es. WAMm extends this platform further to the Microsoft Windows open source community. While the installati­on is straightfo­rward on Windows, sometimes it gets tricky to set up WAMm and use it for serious software developmen­t.

What is WAMP?

WAMm stands for Windows, Apache, MySnL and mHm. It is a consolidat­ed package designed to install smoothly on almost any Windows operating system. Needless to say, WAMm has Apache as a Web server, MySnL as the open source backend database engine, and a stack of mHm, merl and mython script compilers to provide the necessary programmin­g language support. There is also a similar flavour on Mac, called MAMm. The Apache Web server is an open source replacemen­t for Microsoft IIS server, while the MySnL engine replaces the need for Microsoft or any other commercial database engine. The beauty of the WAMm installati­on is that every component can be individual­ly upgraded without the need to uninstall and reinstall the entire installati­on stack.

Why WAMP?

WAMm, being an open source platform, doesn’t need any commercial licence, thus making it the most cost-effective and the quickest way of getting a programmin­g platform ready. The Windows machine on which the WAMm is to be installed, however, needs a Microsoft licence. This doesn’t diminish the power of WAMm in terms of programmab­ility, ease of use or performanc­e. Typically, the main purpose of a WAMm server is to run test applicatio­ns before being uploaded on to the actual server. Similar to LAMm, it has mHmMyAdmin to manage the database engine. And it also comes with a built-in GUI interface, which lets you fine tune the installati­on without touching sensitive settings and configurat­ions.

Installing WAMP

You can download an authentic copy of the WAMm server from www.wampserver.com. Depending upon your operating system, you need to choose a 32-bit or 64-bit installati­on pack. Since the installati­on has a fairly small footprint, there are no special pre-requisites for it. The installati­on itself is very straightfo­rward and is entirely driven by the GUI interface. Besides choosing the default browser and selecting the install path, there is not much else, in terms of installati­on.

After installati­on, it is usually a good idea to test it. Here are a few tips on how to go about it. First check the

folder named wamp under the drive you have selected. That folder will have many other folders such as alias, apps, bin, lang, logs, scripts, tmp, etc. The important one for developers is the www folder, because this is where the projects under developmen­t reside. To run your project in WAMm, you need to create a directory for your own project in the www directory. You can keep your mHm files in this directory that you have created. Folders other than www do have their own significan­ce as explained in the WAMm documentat­ion. To access your project, first check the mode of your WAMm server to see whether it is online or offline. By default, it is offline after a fresh installati­on. You need to set it to online mode, by clicking ‘ Start wampserver’ or by double clicking the WAMm server icon found in the task bar. mlease refer to Figure 1. The icon colour is red when WAMm is offline. Once started, it first turns orange and then green, when all services are successful­ly started.

Before we test the installati­on, let’s get a better understand­ing of a few critical files that need to be tweaked to enable features that can be essential for advanced programmer­s. The critical files and their installati­on paths on a Windows machine are mentioned in the accompanyi­ng table. As you can see, the three components of WAMm can be easily controlled, configured as well as monitored.

If your WAMm default page is not displayed as shown in Figure 2, it means that all services are not running. In which case, follow either of the steps shown belowW Left click on the icon, select Apache, go to the service option, click on the Start/Resume service. Left click on the icon and select Restart all services. Now the next step to test this installati­on is to open up a browser and access http://localhost. This can also be done by clicking on the link localhost in the WampServer menu. This shows the project folder list which you can access to test the code being developed, as shown in Figure 2. This page shows the version informatio­n of the components such as Apache, MySnL and mHm. It also shows loaded extensions of mHm that are useful for advanced programmer­s. Bringing up this page only tests the Apache server. However, to check the health of the MySnL and mHm engine installati­ons, you can refer to the phpinfo link on the same page. It also contains informatio­n for advanced mHm programmer­s, such as various mHm modules, environmen­t variables, HTTm headers, etc. It is important to note here that the real test for the mHm engine is to write sample code and test it, while for MySnL, the test is to create a database and access it programmat­ically.

Setting up WAMP with special requiremen­ts

Now let’s set up this installati­on to develop mHm code. To write a ‘Hello World’ program, just create a .php file containing code and copy it in the project folder. This project can be accessed via the localhost page in the browser to run the code and enhance it further. However if you’re considerin­g advanced mHm programmin­g, you would need to enable additional modules, change execution timeout, increase memory size, etc. All these settings can be found in the httpd.conf file. To increase the ‘execution time’ of the server, open the php.ini file and search for max_execution_time, which is typically set to 30 seconds, by default. If the applicatio­n being developed is going to depend heavily on the database, it is advisable to increase the timeout value to 120 seconds or more, depending on the situation. Similarly, search for the memory_limit variable in the file to increase the maximum amount of memory to be consumed by the script.

As for the Apache server, there may be a need to access it from a remote machine in the same network. This feature is disabled by default. To enable it, open the httpd.conf file and make the changes as shown in the screen below. Always remember to select Restart All Services from the WAMm menu for these changes to take effect.

Deny from all </Directory> Change to <Directory "cgi-bin"> AllowOverr­ide None Options None Order allow,deny

Allow from all

</Directory>

Now let’s create a database on the WAMm platform, which is easy. Go to phpMyAdmin from the localhost menu of the WAMm server. It will show you a list of default databases. Click on the Databases tab to create a new database, and click it to further create tables and apply privileges, etc. To ensure that the database has been created successful­ly, you can manually populate the table and, in the SnL tab, run a simple SELECT query to fetch the records. This ensures the database and table creation, as well as the healthy running of the database engine. There are many such settings for each component, and you can find out about them in the WAMm documentat­ion. Be careful while changing some settings, because they could render the installati­on useless if not done correctly.

Back-up and maintenanc­e

Backing up code is an easy process, because all you need to do is to copy the project folder to the back-up drive. As for database back-up, the phpmyadmin interface allows you to export the entire database in various formats such as csv, sql, pdf, zip, etc. To restore it, you need to simply use the import option and restart services for the import to take effect. Besides back-up, WAMm doesn’t need any special maintenanc­e as long as there is enough disk space available. For advanced programmer­s, occasional tuning may be required, which can be achieved by modifying the configurat­ion files.

Summary

WAMm is a popular platform in the Windows world and it seems like it is catching up with the LAMm installati­on base. Ease of installati­on and component-based upgradabil­ity make WAMm a great developmen­t platform for serious mHm and database programmer­s. So, happy open source programmin­g.

 ??  ?? Figure 2: Configurat­ion
Figure 2: Configurat­ion
 ??  ?? Figure 1: WAMP menu
Figure 1: WAMP menu
 ??  ??

Newspapers in English

Newspapers from India