Jump to Navigation

How to run ASP on apache

Recently we had to take over a project where the original developers had decided to use Microsoft's active server pages (asp) as the development language. We had to temporarily maintain this site while it was re-developed in Drupal. Needless to say this was a nightmare.

ASP application from hell

Although many of the pages ended in the .asp extension most of them contained no ASP code. On those pages where code was used it was minimal. There was no code/page reuse via include directives with each page being a complete copy of the original template. The site consist of over 3000 individual html pages. Changing a menu option meant editing nearly over 200 files! Changing the file extension was not an option because:

  • We could not be sure all the correct pages would be changed,
  • There was still some asp code around, and
  • There was insufficient budget for the work

How to run ASP on apache server

One of the first challenges we faced was where to host the test site for changes. Since we don't have any windows boxes we needed to find a way to do this on Apache. There is SUNs chilisoft's ASP engine for Apache but we didn't want to pay for something we only intended to use for a fewweeks.

We tried out Apache:ASP but either the ASP coding was bad or the module didn't work as advertised because apache threw "500 internal server error". It appeared that the use of the single quote for comments caused problems for the module.

There was also the possibility of using asp2php, a script to automatically convert form asp to php, but this was unlikely to work 100% and we weren't being paid enough to do the remaining manual conversion that would be required.

Apache directives to the rescue

Finally we decided, since there wasn't tha much we would just tell apache to treat the pages as html. To do this we added the following snippet to our httpd.conf file

AddType text/html .asp
AddHandler application/x-httpd-php .asp

Essentially telling apache to push the page request through the php parser. I would have preferred to use the default html handler to process the file but I couldn't find the correct directives to do this.Now we can make changes and view them before taking them live.

ASP.Net and apache

If you have to work with an ASP.net site you're in more luck than the older ASP vbscript. The mono project has done a lot of work to make sure that ASP.net can run on apache. I have no personal experience with it but reports seem good. Check out mod_mono.

Open Source: 
PHP: 


by Dr. Radut.