Gossamer Forum
Home : Products : Links 2.0 : Installation -- Windows :

Solution for Win2k, IIS, Perl, cgi

Quote Reply
Solution for Win2k, IIS, Perl, cgi In reply to
Hello,
had the same problems under Win2K:

- wrong cgi-mapping, mime problem ( tried to rename .cgi's to .pl)
- got unicode error
CGI ERROR
==========================================
Error Message : fatal error: Can't find unicode character property definition via main->a or a.pl at unicode/Is/a.pl line 0

Script Location : d:\websites\adn-netcomar\cgi-bin\links\admin\nph-build.pl
Perl Version : 5.006

- no rated , top or detailed pages were created.

I solved the problems by doing the following: (First I've to say that I'm an german government employee, so that it is possible, that there are some descriptions in "baffling english" - not in cause of the fact that I'm an government employee but in fact of that I'm an german ;-)) )


FIRST
Try to take an overlook in the Support Forum by Searching with the words "Can't find unicode character property definition via main" or " unable to create top, cool, rated pages" you'll be astonished how many people have the same problem!

SECOND
Read read "dwenaus" explantations in
http://www.gossamer-threads.com/perl/forum/showthreaded.pl?Cat=&Board=L2Win&Number=108996&page=&view=&sb=&vc=1#Post108996

which describes 80% of the thing you'll have to do ( I commented dwenaus steps and mark my comments with ">>"):

dwenaus wrote:
Hi,

I managed to install links 2.0 on a windows 2000 server running IIS 5.0 and ActivePerl. What a huge head ache it was.
Before I begin I should say, if you have the option to intall on a UNIX machine you will save yourself hours.
Here is what I did to make it work, (I hope I don't leave anything out) I used a search and replace program to do all the changes below, otherwise it would be impossible. I used BBedit on the mac.

- I found another program that was running perl on the server and simply copied that path to perl and added it in all the files. I used "#!c:\program files\perl\bin\perl.exe"

>>add by JoKoHo
>>
>> I simply installed ActiveStates Perl distribution with standard options and full IIS support. It will then handle that "problem" from itself. Just left "#!/usr/bin/perl" and "#!/usr/local/bin/perl" in the scripts. Thanks to ActiveState doing that by extending the PATH-Variable with "C:\Perl\bin\" ;-). For further help look at
http://aspn.activestate.com/ASPN/Reference/Products/ActivePerl/faq/Windows/Install.html
>>
>>add by JoKoHo

- i renamed all the files that were .cgi to .pl so that active perl could read them properly. i don't know why this works, but it does. i also had to do a huge search and replace in all the code to change every occurance of .cgi to .pl

>>add by JoKoHo
>>
>> Just edit the Webserver-Configuration to run .cgi's like .pl's - how? Hm, look at:
http://aspn.activestate.com//ASPN/Perl/Products/ActivePerl-5.6/faq/Windows/ActivePerl-Winfaq6.html#How_do_I_configure_Microsoft_IIS
where you're told: (specially look at top 9 and 11 - so you have to simply add ".cgi" in the extension field - ready to run cgi's like pl's)
To configure IIS or PWS 4.0 to run Perl scripts:
1. Open the IIS 4.0 Internet Service Manager. This will bring up the Microsoft Management Console with the Internet Service Manager snap-in selected.
2. From the tree display on the left, select the level at which to apply the mappings. You can choose an entire server, web site, or a given virtual directory.
3. Select Properties from the Action menu.
4. If you chose to administer the properties for the entire server, the Server Properties dialog will appear. Select WWW Service from the Master Properties pull-down menu and click the Edit button under Master Properties. This opens WWW Service Master Properties. Select the Home Directory tab and proceed to step 7.
5. If you chose to administer the properties for an entire web site, the Web Site Properties sheet appears. Select the Home Directory tab and proceed to step 7.
6. If you chose to administer the properties for a virtual directory, the Virtual Directory Properties sheet appears. Select the Virtual Directory tab and proceed to step 7.
7. Click the Configuration button. This opens the Application Configuration dialog.
8. Select the App Mappings tab and click the Add button. You see the Add/Edit Application Extension Mapping dialog.
9. To run Perl as a CGI application, type the full path to Perl.EXE followed by %s %s. When a script is executed, the first %s will be replaced by the full path to the script, and the second %s will be replaced by the script parameters.
10. To run Perl for ISAPI, type the full path to PerlIS.DLL. The %s %s is not required for ISAPI DLLs.
11. In the Extension field, type .pl or .plx (or whatever extension you want to use).
12. The application mapping is now complete. Click the OK button and click OK to dismiss any remaining dialogs/property sheets.
13. Close the IIS 4.0 Internet Service Manager.
>>
>>add by JoKoHo


- I changed the link.cfg file accordingly and had to use double back slashes becuase perl thinks you are excaping the character. Now maybe there is a way to turn this off in Perl but I don't have access to the server. here is what I used: "D:\\mysite\\cgi-bin\\links\\admin" for the $db_script_path.

>>add by JoKoHo
right way! without that it would'nt work. and thats critical to this and other scipts too! Windows-paths (absolute File-System-Path's I mean! Not URL's!) in perl-scripts must have (ok ok some don't - but who can figure out which and which not - only trying gives the answer!) the form X:\\lokaldirectory\\subdirectory\\subsub\\... You have to try out if there are more absolute File-System-Paths to figure out, but for LINKS 2.0 here is only LINK.CFG to edit and have the script run. Be aware that there are more path definitions in the last part of the LINKS.CFG !! so I edited LINKS.CFG like that ( don't be worry - I naturaly use the german adaption of LINKS 2.0 from http://www.nicky.net/ but the structure is the same!):
# -------------
# Links
# -------------
# Links Manager
#
# File: links.cfg
# Beschreibung: Contains all the setup variables.
# Author: Alex Krohn
# Email: alex@gossamer-threads.com
# Web: http://www.gossamer-threads.com/
# Version: 2.01
#
# (c) 1998 Gossamer Threads Inc.
#
# This script is not freeware! Please read the README for full details
# on registration and terms of use.
# =====================================================================
#
#
# German Translation by Nicky
# http://www.nicky.net
# Deutsches Forum http://forum.nicky.net

# PFADE UND URLS BITTE ZU IHREN SERVER ABSTIMMEN
# --------------------------------------------------------
# PFAD UND URL für ADMIN CGI Verzeichnis. Ohne Schrägstrich.
$db_script_path = "C:\\Inetpub\\wwwroot\\cgi-bin\\link2.0d\\admin";
$db_dir_url = "http://www2.kreisolpe.intra.net/linksd/admin";

# URL für BENUTZER CGI Verzeichnis. Ohne Schrägstrich.
$db_cgi_url = "http://www2.kreisolpe.intra.net/linksd";

# PFAD UND URL für HTML Verzeichnis. Ohne Schrägstrich.
$build_root_path = "C:\\Inetpub\\wwwroot\\cgi-bin\\link2.0d\\pages";
$build_root_url = "http://www2.kreisolpe.intra.net/linksd/pages";

# PFAD UND URL für NEU Verzeichnis. Ohne Schrägstrich.
$build_new_path = "$build_root_path\\Neu";
$build_new_url = "$build_root_url/Neu";

# PFAD UND URL für COOL Verzeichnis. Ohne Schrägstrich.
$build_cool_path = "$build_root_path\\Cool";
$build_cool_url = "$build_root_url/Cool";

# PFAD UND URL für TOP Verzeichnis. Ohne Schrägstrich.
$build_ratings_path = "$build_root_path\\TOP";
$build_ratings_url = "$build_root_url/TOP";


# Datenbank Optionen
# --------------------------------------------------------
# Flock können Sie unter Linux/Unix Servern benützen, bei/oder Windows Servern stellen Sie es auf 0
$db_use_flock = 1;
# Sollen die Seiten ge-chach-ed werden? (0 = cache, 1 = keincache)
$db_nocache = 0;
# IIS headers benutzen? (1 = ja, 0 = nein).
$db_iis = 1;
# Feldnummer für die Kategorie
$db_main_category = 1;
# Referers -- welcher server darf links zufügen.
@db_referers = ();

# Email Optionen
# --------------------------------------------------------

# PFAD für Sendmail. # SMTP Server
$db_smtp_server = '233.172.22.25';

# Administrator Email. Bitte eine Eintragen!
$db_admin_email = 'me@you.com';

# Benutzer informieren wenn sein Link freigeschaltet wurde? (1 = ja, 0 = nein).
$db_email_add = 0;

# Benutzer informieren wenn sein Link geändert wurde? (1 = ja, 0 = nein).
$db_email_modify = 0;

# Log Datei für ausgehende Mails. Den genaueren PFAD angeben. Beim leer lassen wird es ignoriert. TIP, leer lassen ! Spart Platz am Server.
$db_mailer_log = 'C:\\temp\\linksd.log';

# Erstellungs Optionen
# --------------------------------------------------------
# Popularität der Links
$db_popular_cutoff = 0.03; # Top 3%
# $db_popular_cutoff = 10; # Top 10
# Einstellung wie lange werden die Links als neu angezeigt.
$db_new_cutoff = 8; # 14 Tage.
# Gesuchtes Begriff als Fett anzeigen ? (1 = ja, 0 = nein).
$search_bold = 1;
# Dateiname der Hauptdatei.
$build_index = "index.html";
# Endung der restlichen Dateien:
$build_extension = ".html";

$db_single_category = 1;

# CHMOD der Verzeichnise
$build_dir_per = 0777;


$build_span_pages = 1;

# Links pro Seite.
$build_links_per_page = 10;

# Soll die Detailierte Ansicht für jeden Link erstellt werden ? (1 = ja, 0 = nein).
$build_detailed = 1;
$build_detail_path = "$build_root_path\\Detailiert";
$build_detail_url = "$build_root_url/Detailiert";

# Vorlagen(Templates) benutzen ? (1 = ja, 0 = nein).
$build_use_templates = 1;

# Siten Titel
$build_site_title = 'Intranet-Linkliste';

# AB HIER BITTE NICHTS ÄNDERN
# --------------------------------------------------------

sub date_to_unix {

my $date = shift; my $i;
my %months = map { $_ => $i++ } qw!Jan Feb Mar Apr Mai Jun Jul Aug Sep Okt Nov Dez!;
my ($day, $mon, $year) = split(/-/, $date);

exists $months{$mon} or return undef;
$day = int($day); $year = $year - 1900;

require Time::Local;
my $time = 0;
eval {
$time = &Time::Local::timelocal(0,0,0, $day, $months{$mon}, $year);
};
if ($@) { die "Ungültiges Datum Format: $date - parsed as (day: $day, month: $months{$mon}, year: $year). Grund: $@"; }
return $time;
}

sub unix_to_date {

my $time = shift;
my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $tz) = localtime $time;
my @months = qw!Jan Feb Mar Apr Mai Jun Jul Aug Sep Okt Nov Dez!;
$year = $year + 1900;
return "$day-$months[$mon]-$year";
}

sub long_date {

my $time = shift;
$time = &date_to_unix ($time);
my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $tz) = localtime $time;
my @months = qw!Januar Februar Maerz April Mai Juni Juli August September Oktober November Dezember!;
my @days = qw!Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag!;
$year = $year + 1900;
return "$days[$dweek], $day $months[$mon] $year";
}


$db_script_url = $db_dir_url . "/admin.cgi";
$db_header_path = $db_script_path . "\\header";
$db_footer_path = $db_script_path . "\\footer";
$build_search_url = $db_cgi_url . "/suchen.cgi";
$build_add_url = $db_cgi_url . "/eintrag.cgi";
$build_modify_url = $db_cgi_url . "/aendern.cgi";
$build_jump_url = $db_cgi_url . "/verweis.cgi";
$build_email_url = $db_cgi_url . "/mails.cgi";
$build_rate_url = $db_cgi_url . "/bewerten.cgi";
$db_mail_url = $db_dir_url . "/nph-email.cgi";
$build_css_url = $build_root_url . "/links.css";

$db_lib_path = $db_script_path;
$db_links_name = "$db_script_path\\data\\links.db"; # PATH to links database.
$db_category_name = "$db_script_path\\data\\categories.db"; # PATH to category database.
$db_valid_name = "$db_script_path\\data\\validate.db"; # PATH to validation database.
$db_modified_name = "$db_script_path\\data\\modified.db"; # PATH to modification database.
$db_url_name = "$db_script_path\\data\\url.db"; # PATH to URL lookup database.
$db_email_name = "$db_script_path\\data\\email.db"; # PATH to email database.
$db_links_id_file_name = "$db_script_path\\data\\linksid.txt"; # PATH to links counter file.
$db_category_id_file_name = "$db_script_path\\data\\categoryid.txt"; # PATH to category counter file.
$db_hits_path = "$db_script_path\\data\\hits"; # PATH to hits directory.
$db_template_path = "$db_script_path\\templates"; # PATH to templates.
$db_rates_path = "$db_script_path\\data\\rates"; # PATH to ratings.
1;



note that URL are left with "/" and PATHS are changed to "\\" !!
>>
>>add by JoKoHo


- keeping with this idea i had to change every single hard reference to the path to \\ instead of /. There were over 200+ changes in multiple files. For example, "$db_script_path/data/links.db" had to change to "$db_script_path\\data\\links.db".

>>add by JoKoHo
>>
so I changed - like I mentioned above - the complete "paths" in links.def - (also those under the line wich tells you not to edit anything beyond) - and it worked without doing that "horror-changing" of 200 paths
>>
>>add by JoKoHo



- Everything seemed to work at that point except builds would stall at what's new. So I manually created the New, Cool and Ratings directory in the pages directery. Then I commented out (by adding a #) this code in each of the new, cool and ratings subroutines:
if ($build_new_path =~ m,^$build_root_path\\(.*)$,) {
&build_dir ($1);
}

>>add by JoKoHo
>>
Hey- great! That's the reason for the ugly "Error Message : fatal error: Can't find unicode character property definition via main->a or a.pl at unicode/Is/a.pl line 0"

I first ( and thats the misleading and sneaking of that error-code) looked for that bloody "a.pl" and searched (till my search engine glows) for something like "unicode" in the scripts.
This code checks the existance of the directories for additional pages. So with that is checked, if the directories for the "NEW" "RATED" and "COOL" pages are there and if not- they shall be created. And that (why ever?) doesn't work on Win2k. So the solution is to delete that pieces of code in nph_build.cgi. Note that there is an appearance of that snipplets for each of the subjects. Futher to step 2 of that mission: If you delete the code for creating the directories you have to create them by yourself! Just do it like your definitions in links.def: ( for me it's like that)

in LINKS.DEF I have:
# PFAD UND URL für HTML Verzeichnis. Ohne Schrägstrich.
$build_root_path = "C:\\Inetpub\\wwwroot\\cgi-bin\\link2.0d\\pages";
$build_root_url = "http://www2.kreisolpe.intra.net/linksd/pages";

# PFAD UND URL für NEU Verzeichnis. Ohne Schrägstrich.
$build_new_path = "$build_root_path\\Neu";
$build_new_url = "$build_root_url/Neu";

# PFAD UND URL für COOL Verzeichnis. Ohne Schrägstrich.
$build_cool_path = "$build_root_path\\Cool";
$build_cool_url = "$build_root_url/Cool";

# PFAD UND URL für TOP Verzeichnis. Ohne Schrägstrich.
$build_ratings_path = "$build_root_path\\TOP";
$build_ratings_url = "$build_root_url/TOP";

so I had to create

"C:\Inetpub\wwwroot\cgi-bin\link2.0d\pages\neu" for the "NEW" subject and
"C:\Inetpub\wwwroot\cgi-bin\link2.0d\pages\cool" for the "COOL" subject and
"C:\Inetpub\wwwroot\cgi-bin\link2.0d\pages\top" for the "TOP" subject.

>>
>>add by JoKoHo



- i am still having some problems with deleting files but I think changing the permissions might help. Otherwise links works like a charm.

Best of luch to you all.

By the way, never use the installers dotmatrix.

-Deryk (the hard way)

END OF DWENAUS MESSAGE################################################



So i hope with that I helped you.
It's a very nice Script and its very flexible.- Have a lot of fun...

JoKoHo!



Subject Author Views Date
Thread Building What's New, Cool, Rating does not work Scrootsch 8943 May 3, 2001, 12:34 PM
Thread Re: News, Coole and Rating do not work
Scrootsch 8750 May 7, 2001, 4:47 PM
Thread Re: News, Coole and Rating do not work
angularvelocity 8595 Jun 28, 2001, 10:13 PM
Post Re: News, Coole and Rating do not work
Paul 8576 Jun 29, 2001, 3:22 AM
Thread Re: News, Coole and Rating do not work
Stealth 8763 May 7, 2001, 5:49 PM
Thread Re: News, Coole and Rating do not work
Scrootsch 8770 May 8, 2001, 10:23 AM
Thread Re: News, Coole and Rating do not work
Paul 8742 May 8, 2001, 11:42 AM
Thread Re: News, Coole and Rating do not work
Scrootsch 8753 May 8, 2001, 12:02 PM
Thread Re: News, Coole and Rating do not work
Paul 8730 May 8, 2001, 12:13 PM
Thread Re: News, Coole and Rating do not work
Scrootsch 8752 May 8, 2001, 12:18 PM
Thread Re: News, Coole and Rating do not work
sponge 8737 May 8, 2001, 3:51 PM
Thread Re: News, Coole and Rating do not work
Scrootsch 8696 May 8, 2001, 6:18 PM
Post Re: News, Coole and Rating do not work
admittedlamb 8607 May 27, 2001, 6:13 AM
Thread Solution for Win2k, IIS, Perl, cgi
JoKoHo 8590 Jul 20, 2001, 2:18 AM
Post Re: Solution for Win2k, IIS, Perl, cgi
Stealth 8510 Jul 20, 2001, 10:16 AM
Post Re: Solution for Win2k, IIS, Perl, cgi
Scrootsch 8461 Aug 5, 2001, 6:56 AM