Terminating SAWS and releasing media

Once user has finished working with site SAWS serves, there is a need to free resources taken by SAWS and to stop SAWS, MySQL server (if one was started) and clear database files copied to disk (if it was configured to do this). Typically SAWS is two or more processes named "httpd" or "apache.exe" in process list. They of course won't use CPU cycles when user doesn't make requests to pages served by SAWS, but if SAWS was started from CDROM, then on operating systems other then Windows (i.e. MacOSX and unix-like) user will be unable to eject CDROM unless SAWS is stopped.

Stopping web server for CD programmatically or using web page content

In order to stop SAWS, user must access any resource on the site with URL "/stop-the-server/helper-stop-httpd.exe"; this will trigger execution of a special advanced script, that will initiate a shutdown and then redirect browser to "/spws-terminate-and-release-cd.html". So "/spws-terminate-and-release-cd.html" should contain a (or redirect to) web page that says goodbye, thanks for using the product and so on.

Once request to the "/stop-the-server/helper-stop-httpd.exe" resource is performed, SAWS will continue to serve content for additional 5 seconds (to allow the resource to refer to any other content like scripts, stylesheets, images or even multimedia), and then SAWS will terminate, attempting to eject CDROM if it was started from CDROM. Browser window won't be closed.

It's possible to implement a HTML button (i.e a HTML FORM with a single BUTTON or SUBMIT) that triggers POST request to the url "/stop-the-server/helper-stop-httpd.exe" too. In fact, POST request is more preferred than simple <A HREF="/stop-the-server/helper-stop-httpd.exe"> because browser will not even think about caching results (and if results are cached, the SAWS won't be stopped). If you are implementing STOP functionality via link (instead of a button), use random value as GET argument of the URL, i.e. instead of

<A HREF="/stop-the-server/helper-stop-httpd.exe">


<A HREF="/stop-the-server/helper-stop-httpd.exe?anyname=<?php print rand() ?>">

Using desktop environment to initiate stopping of Web Server

User can stop SAWS using tray icon menu - by right-clicking on tray icon on Windows or Mac and selecting apropriate menu item.

If you configured your project to use Portable Firefox as the browser, you can intruct Webserver for CD to stop automatically once all windows of Portable Firefox are closed, by checking corresponding checkbox in the CDBuilder. Don't forget that there are two checkboxes - in configuration of browser for Windows, and in configuration of browser for Mac OS X.