Thursday, November 18, 2010

Part 2/3 -Running Apache Webserver, PHP, MySQL, Perl, CGI and ASP script without IIS on your Windows Box !!!

In order for ASP.net to work, we need to have a .NET Framework, this is normally pre-installed on all current MS machines. Otherwise, go ahead and download the DOTNETFX framework from Microsoft .NET

In my setup I used Microsoft .NET Framework Version: 2.0, but I suppose any version would be compatible.

Now install mod-aspdotnet for Apache HTTP Server 2.2.X where X is the number of my version. Generally forward and backward compatible through all X. At least I had no problems :)

Click on Browse and navigate your way to install at location folder C:\wamp\bin\apache\apache2.2.X where X is the number associated with your Apache version. Continue installation till finished successfully.


After opening the Apache httpd.conf file, we will add a line to enable the file httpd-aspdotnet.conf, and the best place is right after Virtual Hosts.


# Virtual hosts
# Include conf/extra/httpd-vhosts.conf
# ASP.net
Include conf/extra/httpd-aspdotnet.conf


Now create a new file called httpd-aspdotnet.conf which is saved in folder C:\wamp\bin\apache\apache2.2.X\conf\extra where X is the number associated with your Apache version

# Load asp.net module
LoadModule aspdotnet_module "modules/mod_aspdotnet.so"

# Set asp.net extensions
AddHandler asp.net asp asax ascx ashx asmx aspx axd config cs csproj licx rem resources resx soap vb vbproj vsdisco webinfo

<IfModule mod_aspdotnet.cpp>
# Mount the ASP.NET /ASP application
AspNetMount /ASP "C:/wamp/www/ASP"

# Map all requests for /ASP to the application files
Alias /ASP "C:/wamp/www/ASP"

# Allow asp.net scripts to be executed in the /ASP folder
<Directory "C:/wamp/www/ASP">
# Set asp.net options
Options Indexes FollowSymLinks Includes +ExecCGI
# Set asp.net permissions
Order allow,deny
Allow from all
# Set asp.net default index page to .aspx and .htm
DirectoryIndex index.aspx index.htm
</Directory>

# Set aspnet_client files to serve the client-side helper scripts.
AliasMatch /aspnet_client/system_web/(\d+)_(\d+)_(\d+)_(\d+)/(.*) "C:/Windows/Microsoft.NET/Framework/v$1.$2.$3/ASP.NETClientFiles/$4"
<Directory "C:/Windows/Microsoft.NET/Framework/v*/ASP.NETClientFiles">
Options FollowSymlinks
Order allow,deny
Allow from all
</Directory>
</IfModule>



Create a folder inside folder C:\wamp\www and here we have folder ASP. Under this subfolder

Now create a new text file hello.aspx
<%@ page LANGUAGE="VB" %>
<html> <head>
<body>
<center>
<% Dim I as Integer
For I = 0 to 7 %>
<font size="<%=I%>"> Hello, world!</font> <br>
<% Next %>
</center>
</body>
</html>


On running the ASP dotnetfx file from our localhost. A simple hello world output is generated through ASP without IIS

Ok. Go ahead and experiment. This however is the end of this little tutorial.

Part 1/3- Running Apache Webserver, PHP, MySQL, Perl, CGI and ASP script without IIS on your Windows Box !!!

What you’ll need for this install:
1. WampServer ( Windows Apache Mysql and PHP)
2. ActivePerl

Installing the WAMPServer setup is a quick and easy Apache webserver with PHP support and MySQL on windows.
Installing the Active perl setup in the c:wamp/bin/perl. This will set up a similar structure keeping the files separate, just like it is for php,mySql and Apache folders.

Now you’ll need to install a few extras …
From a command shell
Program Files -> Run -> cmd

cd\perl\bin
ppm

From the Packages select DBI as well as DBD-mysql if not installed and install these.

Now you’ve set up Perl with the extra packages you need its time to tell Apache what to do with .cgi files..
Click the little WampServer icon in your taskbar go up to config files and click on httpd.conf
You’ll want to add in section #cgi Options +ExecCGI

<Directory "cgi-bin">
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
</Directory>



somewhere around “Options Indexes FollowSymLinks”
you’ll also want to add in further down …
AddHandler cgi-script .cgi .pl

Restart Apache (click the icon .. and restart all or just … apache -> restart) … and you should be up and running

you need to create 2 files inside a new folder under www directory of wamp :acgi_form.html
backaction.cgi

Then run the acgi_form.html under wamp server.
Example file :
Create a file named acgi_form.html


<html>
<head>
<title></title>
</head>
<body>
<form action="backaction.cgi" method="GET">
<p>What is your favorite color?
<input name="favcolor" /></p>
<input type=submit value="Send form" />
</form>
</body>
</html>






Create a file named backaction.cgi
#!C:\wamp\bin\Perl\bin\perl.exe

use 5.010;
use CGI;

use strict;
use warnings;

my $q = CGI->new();
say $q->header(), $q->start_html();

say "<h1>Parameters</h1>";

for my $param ($q->param()) {
my $safe_param = $q->escapeHTML($param);

say "<p><strong>$safe_param</strong>: ";

for my $value ($q->param($param)) {
say $q->escapeHTML($value);
}
say '</p>';
}

say $q->end_html();

then , run the wamp server ,
and open the cgi_form.html
( for example : http://localhost/acgi_form.html )

oops, now you may see a 403 Forbidden message like this

Forbidden

You don't have permission to access /backaction.cgi on this server.

Whoops ... thats right. You have to put the script into the cgi-bin.
The ScriptAlias directs all scripts to be found in the /cgi-bin/

also change <form action="backaction.cgi" to <form action="/cgi-bin/backaction.cgi"

Now when you submit your personal favorite color the cgi or perl script will spit back the parameters at you.

Ok, this wraps up part 1 of the installation. In the next round we will learn how to get ASP.NET up and running without IIS.
Take a break and come again soon :)

Monday, November 15, 2010

Tagged Frog

Started using tagged frog a while ago. Unique piece of software which allows you to put labels on your documents and files. ANY document, now you can track all your downloads. No need to sort and file and forget. Sort of like google lables for files and folders.
Saves oodles of time on searching for long lost files. You can keep the same file name as the original down load, and still give it a memorable tag. Applies to pictures, technical documents, your own write ups and whatever else you can think of

Where you can get Tagged Frog