How to run site from CD / DVD without using CDBuilder tool

Required: Placing your scripts to proper location

All PHP scripts are executed similar to the way they are executed using mod_php on Apache web server. Copy all scripts and static documents (html files, images, stylesheets, media files etc) into /site/www/root/. An XCGI - a FastCGI-like protocol is supported by SAWS for Perl code, see introduction to XCGI for more information. Mod_perl for Perl scripts is of course supported too.

Required: Put your database files

If your product uses MySQL

  • Copy database files to proper location as described here. 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 SAWS 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 SAWS 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 SAWS-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.

Remove support for unused features to minimize size

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/.

If your product uses PHP, but doesn't require all PHP extensions supported, just remove corresponding .so files from /extensions/engines/php4-ppc-macosx and /extensions/engines/php4-x86-linux and corresponding .dlls from /extensions/engines/php4-x86-windows/extensions; then update /extensions/engines/php4-x86-windows/php.ini-dist and /extensions/engines/php4-x86-linux/lib/php.ini and /extensions/engines/php4-ppc-macosx/lib/php.ini not to refer to those extensions.

If your product doesn't need php commandline interpreter executable (but still requires mod_php support), remove binaries (/extensions/engines/php4-ppc-macosx/bin/php and /extensions/engines/php4-x86-linux/bin/php).

If your product doesn't use mysql at all, just remove all directories with names containing "mysql" in /extensions/engines/.

If your product doesn't use php, then remove everything with word php in /extensions/engines/ and with word modphp in /httpd/ (and then comment out word 'php4' in /site/config/extlist.conf and update /site/config/httpdmods.conf, commenting out line "modphp4").

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 and from /httpd. 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

/httpd/httpd-x86-linux
/httpd/httpd-x86-windows
/httpd/modperl-x86-linux
/httpd/modperl-x86-windows
/httpd/modphp4-x86-linux
/httpd/modphp4-x86-windows
/httpd/perl_modperl-x86-linux
/httpd/perl_modperl-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 SAWS 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 SAWS to support other platforms, or need some apache module to become supported by SAWS - we also can help you.

Required: Enjoy!

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