ASP2PHP
Table Of Contents
Requirements
Uncompressing and Compiling on Unix
The Command Line
Explaination of Command Line Options
The GUI
The Windows Version
Requirements
There are no requirements for asp2php. You do not need a web
server installed on your system to run this program. This is
a stand-alone program that converts text files written in
asp/vbscript (soon jscript) into text files written in PHP.
Uncompressing and Compiling
First untar the archive with:
tar xvzf asp2php.tgz
Next type:
make (to compile asp2php)
make install (this will install asp2php in /usr/local/bin/ if you want. This is not required)
make gui (optional if you want the gui)
The Command Line
Usage: asp2php <-options> <infile.asp>
-o <output filename>
-dir (input and output files are directories so copy recursively)
-mysql -odbc -oracle -sybase -postgres (to select database)
-uid <database username>
-passwd <database password>
-database <database name or sid>
-address <database ip address or ip name>
-dsn <database ODBC dsn>
-pngs (for converting links to gifs into png)
-y2k (if your asp came from non-y2k compliant NT Box)
-php3 or -php4 (change extension to .php3 or php4 instead of .php)
-toupper (change all variables to uppercase)
-tolower (change all variables to lowercase)
-html (change links to .htm files to .html)
-includes (change #includes to php requires())
-addextension .xxx (filenames with .xxx extension get asp2php translated)
-spacer (Space out php code differently)
-gif2png (use gif2png instead of ImageMagick [-pngs mode only])
-nomagick (don't convert gif files to png [-pngs mode only])
-global_asa (include global.php in all pages)
-fixwinpaths (fix windows paths [ '\' becomes '/' ])
-longexternvars (use, for example, $HTTP_POST_VARS instead of $_POST)
-fulltags (asp2php will use <?php instead of <?)
-change_response_links (in response.write text as .asp will change to .php)
Basically you can just type:
asp2php myaspfile.asp
asp2php will create a php file called: myaspfile.php
Asp2php will use default options to convert your pages. If
you have database connections in your asp, asp2php will automatically
try and figure out what to use for username, password, etc. for the
PHP app. If you'd like to override these you can do so with command
line options. Other command line options let you tell asp2php which
type of database you'll be using on the PHP side, what the output
file should be, or if asp2php should convert links to gifs to
php.
The -pngs mode allows asp2php to convert image tags to point to
pngs instead of gifs (this is due to the fact that web pages
that use GIF's must pay a big unnamed company $5,000 for licensing).
For example:
<img src="mike.gif"> will get converted to:
<img src="mike.png"> in the new php code.
Explaination of command line options
-dir
If you have a directory full of ASP files that you want to translate
(ie. an entire website), you can translate it like so:
asp2php -dir -o myphpwebsite myaspwebsite
asp2php will create the directory myphpwebsite and copy all the
asp, html, pictures, etc. into myphpwebsite and translate the .asp,
.asa, and any other file extension you want into .php files.
-addextension
If you have some other files with extensions other than .asp that
you'd like to translate, you can add them in with this. For example
if you have some include files with the extension .inc you can type:
asp2php -dir -addextension .inc -o myphpwebsite myaspwebsite
You can have as many of those as you need.
-global_asa
This is limited support for global.asa files. You'll need to add
the .asa extension on command line with -addextension .asa. This
will tell asp2php convert your global.asa file into global.php. By
using the -global_asa command line option asp2php will automatically
add <? include('global.php'); ?> to the beginning of all your pages.
-change_response_links
If you have in your ASP code things such as:
Response.Write "<a href='blah.asp'>"
This tag will change references in Response.Write with .asp to .php. So,
for example, the VBScript line above will change to:
Response.Write "<a href='blah.php'>"
The GUI
To build the GUI simply type:
make gui
To run the GUI just type: ./gtkasp2php
I'll have more docs on how to use it later. I don't have time
to write documentation right now. Hopefully it's simple enough
so you don't need docs tho.
The Windows Version
NOTE: It is HIGHLY recommended you use the
Unix/Linux versions over the Windows version. The Windows version
is not as heavily tested. If you do have problems with it please
email me so I know there are things to fix.
After downloading the zip file you need to uncompress
asp2php. You can do this with any version of pkzip or
winzip or whatever. You should have an asp2php directory
now with asp2php.exe in it. You can download pkzip from
http://www.pkware.com/downloads/.
If you get the DOS version you can simply type:
cd c:\temp (assuming you downloaded asp2php to c:\temp)
unzip asp2php-0.76.12.zip
Using asp2php on Windows is the same as Unix. You need to
open a DOS prompt box. Then you need to set your PATH to
point to the directory asp2php is installed in or else when
you use asp2php you must use full paths. For example:
With PATH set correctly:
C:\apache\htdocs> asp2php -o phpdir -dir aspdir
Without PATH set correctly:
C:\apache\htdocs> c:\temp\asp2php\asp2php asppages -o phpdir -dir
To set your path correctly (assuming asp2php is installed in
c:\temp\asp2php) you can type:
set path=c:\temp\asp2php
If this is too much work you can download a graphical interface
to asp2php by Jonas Lindau at
http://hem.passagen.se/lindau/apwg/.