Support → Documentation → Stunnix Perl Web Server

# Required: Download a proper trial

First, you need to download proper SPWS trial, so that all required modules.

- If your site is scripted in Perl and DOES NOT use MySQL or SQLite and does not use HTML::Mason download a demo of SPWS from the bottom of this page.
- If your site is scripted in Perl and DOES NOT use MySQL or SQLite and uses HTML::Mason, feel free to download a demo of SPWS from the this page. That demo already includes all required HTML::Mason modules.
- If your site is scripted in Perl or PHP and uses MySQL OR SQLite, register here for receiving a download link to a trial that includes everything (perl,php,mysql,DBI and DBD for Perl for Windows, OSX and Linux).

# Required: Placing your scripts to proper location

All PHP scripts are executed using CGI convention. Copy all CGI scripts (including PHP scripts) and static documents (html files, images, stylesheets, media files etc) into `/site/www/root/`. An XCGI - a FastCGI-like protocol is supported by SPWS for Perl code, see introduction to XCGI for more information.

# Required: Put your database files

## If your product uses MySQL

- Grant permissions to database objects properly and copy database files to proper location as described here (this is required only if using SPWS version less than 2.1). PHPMyAdmin included with full trial can be used for administration of database.
- If accessing MySQL database from Perl, update your DSN string to contain mysql port number (stored in $ENV{MYSQL_PORT}) as done in `/site/www/root/mysqldemo.pl` from full trial cd.
- Update PHP and Perl scripts to use host=127.0.0.1 in database connection string.

## If your product uses SQLite

- Convert SQLite database to proper format (understood by sqlite library shipped with SPWS demo) and put database files to `/extensions/data/sqlite_data/`.
- Update PHP and Perl scripts to use environment variable `SQLITE_TABLES` as a directory with SQLite database files in database connection string as done in `/site/www/root/sqlitedemo.php` and `/site/www/root/sqlitedemo.pl` .

# Required: Choose the database access mode

MySQL and SQLite databases located on CDROM with SPWS can be independantly from each other configured to either be:

1. accessed directly from cdrom
2. copied to harddisk only first time product is run by given user (thus preserving all changes to database made between sessions)
3. copied to harddisk each time product is run (loosing all changes user makes to database during the session).

The mode is specified by editing `/site/config/extlist.conf`; all possible options are documented in a separate document. . Determine the mode your product should support for each database type (MySQL and SQLite) and modify that file as follows:

#### For MySQL

- for mode 1, replace `mysql_data copy_to_hdd=always` with `mysql_data copy_to_hdd=no`
- for mode 2, replace `mysql_data copy_to_hdd=always` with `mysql_data copy_to_hdd=once` (this will place database files to temporary directory that is cleaned very rarely by users) OR `mysql_data copy_to_hdd=once_to_permdir` (database files will be copied to some permament location outside of temporary files folder) and comment out line with `mysql_remove_data_copied_on_exit`
- for mode 3 do nothing.

#### For SQLite

- for mode 1, replace `sqlite_data copy_to_hdd=always` with `sqlite_data copy_to_hdd=no`
- for mode 2, replace `sqlite_data copy_to_hdd=always` with `sqlite_data copy_to_hdd=once` (this will place database files to temporary directory that is cleaned very rarely by users) OR `sqlite_data copy_to_hdd=once_to_permdir` (database files will be copied to some permament location outside of temporary files folder) and comment out line with `sqlite_remove_data_copied_on_exit`
- for mode 3 do nothing.

# Optional: Make your product more user-friendly

It's greatly recommended to add some text to `/README.html`.

Edit `/site/config/siteinfo.pm` and replace `Perl-Obfus-2.0-Standard-0` there with your site identifier (string without spaces). Putting anything other than `Perl-Obfus-2.0-Standard-0` will allow your product to coexist (and run concurrently) with other SPWS-based products on the same computer.

You can put an icon to the top directory of your CDROM and update your `/autorun.inf` accordingly so that the icon is displayed in Windows Explorer instead of default CDROM icon when your CDROM is inserted into tray.

You may also remove unneeded files from CDROM. E.g. if your product doesn't use MySQL server, then you can remove all directories with "mysql" in their name from `/extensions/data` and `/extensions/engines/`. You may also remove extensions for platforms you don't support from `/extensions/engines/` and from `/perl` too (though we greatly recommend not to do this since e.g. if your product works on OSX, then there is a big probability that it will also work on Linux - why limit abilities of your product?).

It's recommended to remove all traces of demos included with trial to make your product look polished. Just remove all extra files that are not part of your product from `/site/www/root/` and everything from `/site/www/apps`.

## Remove support for unused platforms to minimize size

Find directories with names containing names of platforms your product doesn't support, and remove them in the following directories: `/extensions/engines/` and from `/perl`. E.g. if you have a MacOSX version of cdrom with your your site, you can delete

    /extensions/engines/mysql-x86-linux
    /extensions/engines/mysql-x86-windows
    /extensions/engines/perldbddbi-x86-linux
    /extensions/engines/perldbddbi-x86-windows
    /extensions/engines/php4-x86-linux
    /extensions/engines/php4-x86-windows

    /perl/linux-x86
    /perl/win32

But keep in mind that we greatly recommend not to remove support for other platforms this since e.g. if your product works on OSX, then there is a big probability that it will also work on Linux - why limit abilities of your product?.

It's recommended to remove all traces of demos included with trial to make your product look polished. Just remove all extra files that are not part of your product from `/site/www/root/` and everything from `/site/www/apps`.

# Optional: Consider protecting your code from theft and analysis

- To protect JavaScript from analysis and theft and for mangling html, you can use Stunnix JavaScript Obfuscator;
- To protect VBScript from analysis and theft and for mangling html, you can use Stunnix VBScript and ASP Obfuscator;
- To protect Perl scripts from analysis and theft, you can use Stunnix Perl-Obfus - an advanced obfuscator and encoder for Perl source code;
- To protect PHP scripts from analysis and theft, you can use IonCube PHP encoder - it's already integrated into SPWS and supported on all platforms.

# Optional: Request any help from us

Please contact us if you have any questions. If PHP available with our trial doesn't contain a module you need, or wish to make SPWS to support other platforms, we also can help you.

# Required: Enjoy!

Enjoy our product and tell your partners and friends about how exciting it is :)