doc/install/windows/auth-server

Installing WiFiDog on Windows XP

THIS GUIDE IS IN PROGRESS

After a huge effort, I have managed to get WiFidog? Auth running on Windows XP. Here is how I did it...

Note: I cannot get WiFiDog to work with IIS

Perquisites

Installation

Installing Postgres

UnZip? the folder then Run the msi and select all default options, creating users and passwords when prompted.

Installing Apache

Run the msi and select all defaults.

Installing PHP

Run the msi when prompted select “Apache 2.2.x Module”

set apache configuration directory e.g. C:\Program Files\Apache Software Foundation\Apache2.2\conf\

Install all options (including pear) and Make sure ONLY the following Extensions are selected for installation

  • activescript
  • curl
  • dio
  • gd2
  • gettext
  • htscanner
  • pecl_http
  • ldap
  • multi-byte string
  • mcrypt
  • mhash
  • pdflib
  • postgreSQL
  • Standard PHP
  • SVN
  • win32service
  • win32std
  • xmlrpc
  • xsl
  • zip

Installing WiFiDog

Extract Wifidog to “C:\wwwroot\” (create the folder if it doesn't exist)

Extract Smarty using a utility such as 7ZIP to “c:\wwwroot\wifidog-auth\wifidog\lib\”

Configuration

Start > All Programs > PostgreSQL 8.2 > PGADMIN III

right click on your super user and click connect, then enter your password

click the plus to expand the tree

right click on the login role and click "new login role..."

add wifidog to the "role name" and enter a password, then click ok.

right click on the database icon and click "new database..."

name = wifidog

owner = wifidog

encoding = utf8

goto Start > All Programs > Apache > httpd.conf

find the line

DocumentRoot = "C:/Program Files/Apache/htdocs"

And replace it with

DocumentRoot "C:/wwwroot/wifidog-auth/wifidog"

and

<Directory "C:/Program Files/Apache/htdocs">

with

<Directory "C:/wwwroot/wifidog-auth/wifidog">

and

DirectoryIndex index.html

with

DirectoryIndex index.html index.php

In your internet browser, Browse to "localhost/install.php" and follow the installation script using the work arounds outlined below:

NOTE: Wifidog_Cookie.txt will either be placed in C:\tmp. if this doesn't happen, you may receive the Auth Required box, but just click OK...

Work Arounds

Install script freezes at Permissions page: Possibly fixed in latest svn

Replace the following code in install.php (note this may change if install.php is updated)

 
385         $process_info_user_id = posix_getpwuid(posix_getuid()); 
386  
387         if($process_info_user_id){ 
388             $process_username = $process_info_user_id['name']; 
389         } 
390         else { 
391             //Posix functions aren't available on windows 
392             $process_username = 'unknown_user'; 
393         } 
394         $process_info_group_id = posix_getgrgid(posix_getegid()); 
395         if($process_info_group_id){ 
396             $process_group = $process_info_group_id['name']; 
397         } 
398         else { 
399             //Posix functions aren't available on windows 
400             $process_group = 'unknown_group'; 
401         } 
402         $cmd_mkdir = ''; 
403         $cmd_chown = ''; 
404         $error = 0; 
405  
406         print "<p><em>HTTP daemon UNIX username/group</em>: $process_username/$process_group</p>"; 
407         #    print "<p><em>HTTPD group</em>: $process_group<BR</p>"; 
408         print "<p><table BORDER=\"1\"><tr><td><b>Directory</b></td></td><td><b>Owner</b></td><td><b>Writable</b></td></tr>\n"; 
409  
410         foreach ($dir_array as $dir) { 
411             print "<tr><td>$dir</td>"; 
412             if (!file_exists(WIFIDOG_ABS_FILE_PATH . "$dir")) { 
413                 print "<TD COLSPAN=\"2\" STYLE=\"text-align:center;\">Missing</td></tr>\n"; 
414                 $cmd_mkdir .= WIFIDOG_ABS_FILE_PATH . "$dir "; 
415                 $cmd_chown .= WIFIDOG_ABS_FILE_PATH . "$dir "; 
416                 $error = 1; 
417                 continue; 
418             } 
419  
420             $dir_info = posix_getpwuid(fileowner(WIFIDOG_ABS_FILE_PATH . "$dir")); 
421             if($dir_info) { 
422                 $dir_owner_username = $dir_info['name']; 
423             } 
424             else { 
425                 //Posix functions aren't available on windows 
426                 $dir_owner_username = fileowner(WIFIDOG_ABS_FILE_PATH . "$dir"); 
427             } 
428             print "<td>$dir_owner_username</td>"; 
429  
430             if (is_writable(WIFIDOG_ABS_FILE_PATH . "$dir")) { 
431                 print "<td>YES</td>"; 
432             } 
433             else { 
434                 print "<td>NO</td>"; 
435                 $cmd_chown .= WIFIDOG_ABS_FILE_PATH . "$dir "; 
436                 $error = 1; 
437             } 
438             print "</tr>\n"; 
439         } 
440         print "</table>\n"; 

with:

/*
* posix_getpwuid() not implemented on Microsoft Windows platforms
*/

if (!function_exists('posix_getpwuid')) {
        print "<p><em>Automated Process not currently avalible on windows.</em> please make sure the following directories exist and have WRITE permissions</p>";
print "<p><table BORDER=\"1\"><tr><td><b>Directory</b></td></tr>\n";

        foreach ($dir_array as $dir) {
            print "<tr><td>$dir</td></tr>";
	}
print "</table>";
$error = 0;
}
else {
$process_info_user_id = posix_getpwuid(posix_getuid());

        if($process_info_user_id){
            $process_username = $process_info_user_id['name'];
        }
        else {
            //Posix functions aren't available on windows
            $process_username = 'unknown_user';
        }
        $process_info_group_id = posix_getgrgid(posix_getegid());
        if($process_info_group_id){
            $process_group = $process_info_group_id['name'];
        }
        else {
            //Posix functions aren't available on windows
            $process_group = 'unknown_group';
        }
        $cmd_mkdir = '';
        $cmd_chown = '';
        $error = 0;

        print "<p><em>HTTP daemon UNIX username/group</em>: $process_username/$process_group</p>";
        #    print "<p><em>HTTPD group</em>: $process_group<BR</p>";
        print "<p><table BORDER=\"1\"><tr><td><b>Directory</b></td></td><td><b>Owner</b></td><td><b>Writable</b></td></tr>\n";

        foreach ($dir_array as $dir) {
            print "<tr><td>$dir</td>";
            if (!file_exists(WIFIDOG_ABS_FILE_PATH . "$dir")) {
                print "<TD COLSPAN=\"2\" STYLE=\"text-align:center;\">Missing</td></tr>\n";
                $cmd_mkdir .= WIFIDOG_ABS_FILE_PATH . "$dir ";
                $cmd_chown .= WIFIDOG_ABS_FILE_PATH . "$dir ";
                $error = 1;
                continue;
            }

            $dir_info = posix_getpwuid(fileowner(WIFIDOG_ABS_FILE_PATH . "$dir"));
            if($dir_info) {
                $dir_owner_username = $dir_info['name'];
            }
            else {
                //Posix functions aren't available on windows
                $dir_owner_username = fileowner(WIFIDOG_ABS_FILE_PATH . "$dir");
            }
            print "<td>$dir_owner_username</td>";

            if (is_writable(WIFIDOG_ABS_FILE_PATH . "$dir")) {
                print "<td>YES</td>";
            }
            else {
                print "<td>NO</td>";
                $cmd_chown .= WIFIDOG_ABS_FILE_PATH . "$dir ";
                $error = 1;
            }
            print "</tr>\n";
        }
        print "</table>\n";
}

Mandatory PHP extentions are missing:

  • Make sure the right extensions have been installed by going to Start > All Programs > PHP > PHP.ini and check that the missing extensions are referenced.
  • create a file called phpinfo.php in C:\wwwroot\ and add the following code:
    <?
    phpinfo()
    ?>
    

then run the file to make sure PHP is configured correctly

Warning in /classes/Locale.php setCurentLocale: Unable to setlocale() to parameter: en_US. I tried en_US.UTF-8, en_US, en.UTF-8, en, and got return value: English_United States.1252, current locale is: English_United States.1252

In /classes/Locale.php comment the line

257         echo sprintf("Warning in /classes/Locale.php setCurentLocale: Unable to setlocale() to %s: %s.  I tried %s, %s, %s, %s, and got return value: %s, current locale is: %s",$q, $locale_id, $candidate_locale_array[0], $candidate_locale_array[1], $candidate_locale_array[2], $candidate_locale_array[3], $current_locale, setlocale(LC_ALL, 0))."<br/>";

This is happening because of the way windows returns the system local. It uses full names for languages rather than the abreviations, so when the first 3 letters ("Eng") are checked against what PHP holds (En_) the if statement fails. to solve this, "substr ($current_locale, 0 , 2)" could be changed to "substr ($current_locale, 0 , 1)" so it only matches the first 2 letters ("En") however this may still fail on languages like German as they use "De". Another way is to check to see if the OS is windows and test accordingly.

WarningSmarty?(Secure) (Or blank screen when browsing to index.php)

In classes\SmartyWifidog?.php Find the line

136         $this->security = true; 

and change it to

136         $this->security = false; 

Apache wont start

Make sure IIS is not running on the same port (if at all)

Incorrect URL The following line in the flie path_defines_base

if ($browser_url == "" || substr($browser_url,-1,1) != '/') $browser_url .= '\';

should be changed to

if ($browser_url == "" || substr($browser_url,-1,1) != '/') $browser_url .= '';