Quick Guide to Sambar


Sambar is a web server available for Windows which offers a lot of features, among which support for virtual hosts (multiple sites sitting on one host) even when using a dynamic IP (ie. you can use hostnames in the configuration file.) The content that the server serves is located in the docs/ folder. Note that as of august 2003, Sambar does not support enhanced version of CGI, eg. FastCGI or SCGI.



  1. http://localhost/session/adminlogin?RCpage=/sysadmin/index.stm
  2. logon = admin, empty password
  3. Click on ??? to set a password
  4. To install Sambar as an NT service, run C:\Program Files\sambar\bin> ntserver -i. To uninstall, run C:\Program Files\sambar\bin> ntserver -u
  5. To run Samba on a different port than 80, still in the System Administration page, click on the Server Configuration link, and change the port number. Click on the Update System Configuration button, and restart Sambar
  6. If running Sambar on a server with a dynamic IP address, Dynamic IP Test Test periodically : This is necessary for DHCP machines running the FTP server, if they periodically change their IP  address without restarting the Sambar Server.
  7. System Administrator
  8. System Administrator IP
  9. Server Port
  10. Run Watcher
  11. NT Authentication NT Domain
  12. Default Page
  13. Home Page  The only valid use for this parameter is if multiple virtual hosts are used that map to the same documents directory.  Note: This must be a single file name.
  14. Documents Directory : Unless preceeded by a drive letter (i.e. d:/wwwdir) ,the directory is assumed to  be relative to the installation directory of the Sambar Server.

Adding PHP

This requires using the ISAPI module.

  1. Install the PHP binary package. Don't forget the PHP.INI ...
  2. Find the file called mappings.ini (in the config directory) in the Sambar install directory
  3. Go to the [ISAPI] section, and add this : *.php = c:\php\php4isapi.dll (assuming you did install PHP in C:\PHP ....)
  4. Restart Sambar

Note: If you wish to use a newer version of PHP, download the Win32 ZIP into a new directory (eg. C:\PHP431), make the required change in mappings.ini, update the PATH environment variable, and reboot. Restarting Sambar is not enough. If Sambar starts OK with no error message in log/server.log but PHP pages can't be viewed, changes are you didn't reboot...

Virtual servers

Here's how to set up virtual servers with HTTP 1.1, ie. the server only uses one IP address, and Sambar redirects users to such and such directory depending on the "Host" header sent to the server by the web browser:

  1. Create directories to host the different sites, eg. C:\VIRTUAL\SITE-A and C:\VIRTUAL\SITE-B, and create a dummy index.html in each
  2. Launch your browser, and go to the admin section, ie.http://localhost/session/adminlogin?RCpage=/sysadmin/index.stm
  3. In the Servers | WWW Server section, click on Virtual Hosts
  4. Set "Virtual Host Name" to the fully-qualified hostname, eg. "site-a.com", and "Documents Directory" to the directory where files for this site are located, ie. C:\VIRTUAL\SITE-A\ (note the trailing backslash) Note: The Documents Directory directive may contain a path relative to the Sambar Server installation or an explicit path (i.e. c:/foobar/docs/ ).  
  5. Click on Create New Virtual Host
  6. Repeat for the other site
  7. Restart Sambar. From now on, when users aim their browser to http://site-a.com, they will see C:\VIRTUAL\SITE-A\index.html, while when they hit http://site-b.com, they will see C:\VIRTUAL\SITE-B\index.html

Working with Sambar

Files ending with the .stm extension contain Sambar-specific dynamic content. <RCElocaltime> not rendered!

To declare variables and display their content:

<RC$title = My Web Site>

Hello World <RC$title>



Sambar crashes when querying a PHP file

Make sure NT's PATH environment variable includes the directory where PHP4ISAPI.DLL is located (eg. C:\php\sapi). Once you do that, you might be able to run Sambar manually, but running it as an NT service might fail. In this case, try to reboot NT and give it another try

PHP pages are located OK, but with a failure to located include files

I saw this with PHP 4.3.1 for Windows, but no issue when using 4.2.3 . Either a bug or some tweaking needed in PHP.INI?

When using virtual hosts, PHP fetches include files from the wrong directory

When using "include '/test.php' " in a virtual server, this file is fetched from the non-virtual document root, eg. c:\sambar\docs instead of eg. c:\sambar\acme\docs . The reason for this behavior is that PHP looks for files starting from the web server's document directory, instead of a pth relative to a site, which I expected it to. A work-around is to either use file-system-based absolute paths like 'c:/sambar/acme/test.php', relative paths like '../../test.php' (but a pain when moving stuff around...), or use the following:

include "$DOCUMENT_ROOT\test.php";

Moving the docs/ directory out of the Samba directory?

Edit config/config.ini, and change the line that says "Documents directory", eg.

Documents Directory = c:/documents/