在Windows XP SP2安装wifidog认证服务器
在Windows XP安装Wifidog
需求
- postgresql-8.2.5-1.zip:http://www.postgresql.org/ftp/binary/v8.2.5/win32/
- PHP 5.2.5:http://uk3.php.net/get/php-5.2.5-win32-installer.msi/from/a/mirror
- apache_2.2.6-win32-x86-openssl-0.9.8e.msi: http://mirrors.dedipower.com/ftp.apache.org/httpd/binaries/win32/
- Version 2.6.18 of smarty : http://smarty.php.net/download.php
- 最新版本的 WiFidog-Auth :http://dev.wifidog.org/browser/trunk
安装
安装Postgres
解压文件夹,运行msi,选择默认选项,当有系统提示时创建用户和密码。
安装Apache
运行msi并选择所有默认选项
安装PHP
运行msi,有系统提示时,选择“Apache 2.2.x Module”
Apache配置目录,如:C:\Program Files\Apache Software Foundation\Apache2.2\conf\
安装所有选项(包括PEAR),并确认只安装下列扩展
- activescript
- curl
- dio
- gd2
- gettext
- htscanner
- pecl_http
- ldap
- multi-byte string
- mcrypt
- mhash
- pdflib
- postgreSQL
- Standard PHP
- SVN
- win32service
- win32std
- xmlrpc
- xsl
- zip
安装WIFIDOG
将WIFIDOG引入到“C:\wwwroot\”
使用一种实用程序如7ZIP将Smarty引入到“c:\wwwroot\wifidog-auth\wifidog\lib\”
配置
Start > All Programs > PostgreSQL 8.2 > PGADMIN III
右键点击超级用户并点击连接,然后输入你的密码。
点击加号,展开列表
右键点击登录角色,然后点击“新登录角色…”
在“角色名称”输入wifidog,然后输入密码,点击OK
右键点击数据库图标然后点击“新数据库…”
name=wifidog
owner=wifidog
encoding=utf8
goto Start >All Programs >Apache >httpd.conf
找到以下命令
DocumentRoot = "C:/Program Files/Apache/htdocs"
并替换成
DocumentRoot "C:/wwwroot/wifidog-auth/wifidog"
将以下命令
<Directory "C:/Program Files/Apache/htdocs">
替换成
<Directory "C:/wwwroot/wifidog-auth/wifidog">
将以下命令
DirectoryIndex index.html
替换成
DirectoryIndex index.html index.php
Work Arounds
将以下命令
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";
替换成
* 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";
}
缺失必要的PHP扩展:
- 确保在Start>All Programs >PHP >PHP.ini安装了所需扩展,并检测缺失扩展也在内
- 在C:\wwwroot\下创建phpinfo.php的文件,并添加下列代码:
然后运行此文件确保PHP配置正确
在/classes/Locale.php文件中加入以下内容:
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/>";
在classes\SmartyWifidog.php中找到以下命令
136 $this->security = true;
并更改为
136 $this->security = false;
错误的URL 在path_defines_base文件中,将以下内容:
if ($browser_url == "" || substr($browser_url,-1,1) != '/') $browser_url .= '\';
更改为
if ($browser_url == "" || substr($browser_url,-1,1) != '/') $browser_url .= '';
本文章由 http://www.wifidog.pro/2015/03/11/windowxp%E5%AE%89%E8%A3%85wifidog%E8%AE%A4%E8%AF%81%E6%9C%8D%E5%8A%A1%E5%99%A8.html 整理编辑,转载请注明出处