Let's WAMP Up!

Close on the heels of the LAMP de­vel­op­ment plat­form is WAMP. Read on to learn the right steps to in­stall and set it up. This ar­ti­cle also out­lines a few of the typ­i­cal prob­lems faced and of­fers some trou­bleshoot­ing tips.

OpenSource For You - - DEVELOPERS -

LAMm (Linux, Apache, MySnL and mHm) is a very pop­u­lar de­vel­op­ment plat­form in the open source world. Many mis­sion crit­i­cal web­sites are de­vel­oped on this plat­form to lever­age the best of the three open source tech­nolo­gies. WAMm ex­tends this plat­form fur­ther to the Mi­crosoft Win­dows open source com­mu­nity. While the in­stal­la­tion is straight­for­ward on Win­dows, some­times it gets tricky to set up WAMm and use it for se­ri­ous soft­ware de­vel­op­ment.

What is WAMP?

WAMm stands for Win­dows, Apache, MySnL and mHm. It is a con­sol­i­dated pack­age de­signed to in­stall smoothly on al­most any Win­dows op­er­at­ing sys­tem. Need­less to say, WAMm has Apache as a Web server, MySnL as the open source back­end data­base engine, and a stack of mHm, merl and mython script com­pil­ers to pro­vide the nec­es­sary pro­gram­ming lan­guage sup­port. There is also a sim­i­lar flavour on Mac, called MAMm. The Apache Web server is an open source re­place­ment for Mi­crosoft IIS server, while the MySnL engine re­places the need for Mi­crosoft or any other com­mer­cial data­base engine. The beauty of the WAMm in­stal­la­tion is that ev­ery com­po­nent can be in­di­vid­u­ally up­graded with­out the need to unin­stall and re­in­stall the en­tire in­stal­la­tion stack.

Why WAMP?

WAMm, be­ing an open source plat­form, doesn’t need any com­mer­cial li­cence, thus mak­ing it the most cost-ef­fec­tive and the quick­est way of get­ting a pro­gram­ming plat­form ready. The Win­dows ma­chine on which the WAMm is to be in­stalled, how­ever, needs a Mi­crosoft li­cence. This doesn’t di­min­ish the power of WAMm in terms of pro­gramma­bil­ity, ease of use or per­for­mance. Typ­i­cally, the main pur­pose of a WAMm server is to run test ap­pli­ca­tions be­fore be­ing uploaded on to the ac­tual server. Sim­i­lar to LAMm, it has mHmMyAd­min to man­age the data­base engine. And it also comes with a built-in GUI in­ter­face, which lets you fine tune the in­stal­la­tion with­out touch­ing sen­si­tive set­tings and con­fig­u­ra­tions.

In­stalling WAMP

You can down­load an au­then­tic copy of the WAMm server from www.wampserver.com. De­pend­ing upon your op­er­at­ing sys­tem, you need to choose a 32-bit or 64-bit in­stal­la­tion pack. Since the in­stal­la­tion has a fairly small foot­print, there are no spe­cial pre-req­ui­sites for it. The in­stal­la­tion it­self is very straight­for­ward and is en­tirely driven by the GUI in­ter­face. Be­sides choos­ing the de­fault browser and se­lect­ing the in­stall path, there is not much else, in terms of in­stal­la­tion.

Af­ter in­stal­la­tion, it is usu­ally a good idea to test it. Here are a few tips on how to go about it. First check the

folder named wamp un­der the drive you have se­lected. That folder will have many other fold­ers such as alias, apps, bin, lang, logs, scripts, tmp, etc. The im­por­tant one for de­vel­op­ers is the www folder, be­cause this is where the projects un­der de­vel­op­ment re­side. To run your pro­ject in WAMm, you need to cre­ate a directory for your own pro­ject in the www directory. You can keep your mHm files in this directory that you have cre­ated. Fold­ers other than www do have their own sig­nif­i­cance as ex­plained in the WAMm doc­u­men­ta­tion. To ac­cess your pro­ject, first check the mode of your WAMm server to see whether it is on­line or off­line. By de­fault, it is off­line af­ter a fresh in­stal­la­tion. You need to set it to on­line mode, by click­ing ‘ Start wampserver’ or by dou­ble click­ing the WAMm server icon found in the task bar. mlease re­fer to Fig­ure 1. The icon colour is red when WAMm is off­line. Once started, it first turns or­ange and then green, when all ser­vices are suc­cess­fully started.

Be­fore we test the in­stal­la­tion, let’s get a bet­ter un­der­stand­ing of a few crit­i­cal files that need to be tweaked to en­able fea­tures that can be es­sen­tial for ad­vanced pro­gram­mers. The crit­i­cal files and their in­stal­la­tion paths on a Win­dows ma­chine are men­tioned in the ac­com­pa­ny­ing ta­ble. As you can see, the three com­po­nents of WAMm can be eas­ily con­trolled, con­fig­ured as well as mon­i­tored.

If your WAMm de­fault page is not dis­played as shown in Fig­ure 2, it means that all ser­vices are not run­ning. In which case, fol­low ei­ther of the steps shown be­lowW Left click on the icon, se­lect Apache, go to the ser­vice op­tion, click on the Start/Re­sume ser­vice. Left click on the icon and se­lect Restart all ser­vices. Now the next step to test this in­stal­la­tion is to open up a browser and ac­cess http://lo­cal­host. This can also be done by click­ing on the link lo­cal­host in the WampServer menu. This shows the pro­ject folder list which you can ac­cess to test the code be­ing de­vel­oped, as shown in Fig­ure 2. This page shows the ver­sion in­for­ma­tion of the com­po­nents such as Apache, MySnL and mHm. It also shows loaded ex­ten­sions of mHm that are use­ful for ad­vanced pro­gram­mers. Bring­ing up this page only tests the Apache server. How­ever, to check the health of the MySnL and mHm engine in­stal­la­tions, you can re­fer to the ph­pinfo link on the same page. It also con­tains in­for­ma­tion for ad­vanced mHm pro­gram­mers, such as var­i­ous mHm mod­ules, en­vi­ron­ment vari­ables, HTTm head­ers, etc. It is im­por­tant to note here that the real test for the mHm engine is to write sam­ple code and test it, while for MySnL, the test is to cre­ate a data­base and ac­cess it pro­gram­mat­i­cally.

Set­ting up WAMP with spe­cial re­quire­ments

Now let’s set up this in­stal­la­tion to de­velop mHm code. To write a ‘Hello World’ pro­gram, just cre­ate a .php file con­tain­ing code and copy it in the pro­ject folder. This pro­ject can be ac­cessed via the lo­cal­host page in the browser to run the code and en­hance it fur­ther. How­ever if you’re con­sid­er­ing ad­vanced mHm pro­gram­ming, you would need to en­able ad­di­tional mod­ules, change ex­e­cu­tion timeout, in­crease mem­ory size, etc. All th­ese set­tings can be found in the httpd.conf file. To in­crease the ‘ex­e­cu­tion time’ of the server, open the php.ini file and search for max_ex­e­cu­tion_­time, which is typ­i­cally set to 30 sec­onds, by de­fault. If the ap­pli­ca­tion be­ing de­vel­oped is go­ing to de­pend heav­ily on the data­base, it is ad­vis­able to in­crease the timeout value to 120 sec­onds or more, de­pend­ing on the sit­u­a­tion. Sim­i­larly, search for the mem­o­ry_limit vari­able in the file to in­crease the max­i­mum amount of mem­ory to be con­sumed by the script.

As for the Apache server, there may be a need to ac­cess it from a re­mote ma­chine in the same net­work. This fea­ture is dis­abled by de­fault. To en­able it, open the httpd.conf file and make the changes as shown in the screen be­low. Al­ways re­mem­ber to se­lect Restart All Ser­vices from the WAMm menu for th­ese changes to take ef­fect.

Deny from all </Directory> Change to <Directory "cgi-bin"> Al­lowOver­ride None Op­tions None Or­der al­low,deny

Al­low from all

</Directory>

Now let’s cre­ate a data­base on the WAMm plat­form, which is easy. Go to ph­pMyAd­min from the lo­cal­host menu of the WAMm server. It will show you a list of de­fault data­bases. Click on the Data­bases tab to cre­ate a new data­base, and click it to fur­ther cre­ate ta­bles and ap­ply priv­i­leges, etc. To en­sure that the data­base has been cre­ated suc­cess­fully, you can man­u­ally pop­u­late the ta­ble and, in the SnL tab, run a sim­ple SE­LECT query to fetch the records. This en­sures the data­base and ta­ble cre­ation, as well as the healthy run­ning of the data­base engine. There are many such set­tings for each com­po­nent, and you can find out about them in the WAMm doc­u­men­ta­tion. Be care­ful while chang­ing some set­tings, be­cause they could ren­der the in­stal­la­tion use­less if not done cor­rectly.

Back-up and main­te­nance

Back­ing up code is an easy process, be­cause all you need to do is to copy the pro­ject folder to the back-up drive. As for data­base back-up, the ph­pmyad­min in­ter­face al­lows you to ex­port the en­tire data­base in var­i­ous for­mats such as csv, sql, pdf, zip, etc. To restore it, you need to sim­ply use the im­port op­tion and restart ser­vices for the im­port to take ef­fect. Be­sides back-up, WAMm doesn’t need any spe­cial main­te­nance as long as there is enough disk space avail­able. For ad­vanced pro­gram­mers, oc­ca­sional tun­ing may be re­quired, which can be achieved by mod­i­fy­ing the con­fig­u­ra­tion files.

Sum­mary

WAMm is a pop­u­lar plat­form in the Win­dows world and it seems like it is catch­ing up with the LAMm in­stal­la­tion base. Ease of in­stal­la­tion and com­po­nent-based upgradability make WAMm a great de­vel­op­ment plat­form for se­ri­ous mHm and data­base pro­gram­mers. So, happy open source pro­gram­ming.

Fig­ure 2: Con­fig­u­ra­tion

Fig­ure 1: WAMP menu

Newspapers in English

Newspapers from India

© PressReader. All rights reserved.