วันจันทร์ที่ 29 พฤศจิกายน พ.ศ. 2553

Local debugging PERL CGI program

Platform in its own debugging PERL CGI program, the Chinese Win98, for example, need to do the following:

1. To install, set up TCP / IP protocol

2. To install, set up Web server

3. Install PERL for Win32

Detail the various steps:

1, the installation, set TCP / IP protocol

If you have the right to connect via a dialup Internet, it shows your TCP / IP has been installed correctly, but you have to patience to watch yo! Into the "Control Panel", double-click "Network" icon, a "network" dialog box, where have installed TCP / IP. Suppose TCP / IP does not exist, to add it, just click "Add" button, select the "Agreement" and click "Add" button, select "Microsoft" - "TCP / IP", click "OK", the system Tips to Win98 disk, then restart, according as it wants. But wait, this step is not over, but also on the TCP / IP for a number of settings. Select "TCP / IP", click "Properties." In the "DNS Configuration", select "Disable DNS"; in the "IP address" option, select "Specify IP Address" in the "IP Address" enter any valid IP address, such as "10.10.10.10". Thus, installing the Web service, you can in your browser using "http://10.10.10.10" This address local browsing! Be explained that, if you choose the "automatic IP address", then you can only use "http:// to your machine name" the. How to set the machine name? Click the "identity", where "hh" is the machine name, and to emphasize that the Chinese do not use the machine name, otherwise can not be correctly identified and displayed, do remember that Oh!

You might ask, just select "Disable DNS", and "the specified IP address", then dial the Internet when in reality do not go wrong? Yes, in fact, to solve this problem is very simple, you just in the "My Computer", double-click "dialing network", select the connection you created, right-open the "Properties" dialog box, select the "Server Type", click "TCP / IP Settings", where you can select "IP address of the server has been assigned" in the "Specify name server address" enter your ISP provided in the "master DNS" and "secondary DNS" address can, and here I filled the local 163 of the DNS address.

Second, installation, set the Web server

1, Chinese Win98 CD treasure hunt

To install the Web server, but the Web server program come from? Win98 CD in to see what, here is a "add-ons" directory, go see another one "pws", in fact treasures have found that the "pws", which is short for Personal Web Server is "Personal Web Server," We use it to install the Web server on it (in fact, there are many Web server program, here it is more convenient.)!

2, the installation Web server

Before you install the PWS, the system must be IE4.0 or later browser has integrated Chinese Win98

IE4.0, this step can be omitted. Chinese Win98 CD into the "add-onspws" directory, double-click "setup.exe", select "Next", with "typical" installation of PWS to the default directory, but you can use "custom" installation of the components you need to choose the installation is complete, it will build a C under the root directory called "inetpub", the directory, this folder is very important to the future operation of all in here, you are prompted to restart, when the re-start again, you will find more than a small status bar icon, it is the "Personal Web Manager." Hey, I restarted, how will it automatically pop-up dial dialog box?

3, set the Web server

First of all, to solve the above problems. When you install PWS, it's a number of settings have been written to the registry, in every time you start Win98 will automatically run PWS, it will automatically detect network server with a browser, IE and your connection is dial the call network, so the dialog box will pop-up dial.

Right-click the desktop IE, open the "Properties" dialog box, select "Connect", select "LAN to connect to the Internet", this problem will be solved at the same time it can be used browser is an important step local information.

Double-click "PWS" System icon, click the "Start" button, Web publishing has started, quickly open the IE, in the address bar enter "http://hh", if you can open this address, then congratulations, your Web server has been installed successful.

Click the "Advanced" to open the "Advanced Options" settings box, select the "Allow Directory Browsing", double-click the "virtual directory" under the "cgi-bin" directory (if not in this directory, you can advance in the "c: inetpub "directory create a" cgi-bin "subdirectory, and then click click" ", select" Add ", enter in the directory" c: inetpubcgi-bin ", the alias type" cgi-bin " This would be in the "virtual directory" "" under a "cgi-bin" directory), pop-up "Edit List" dialog box, you can see, it's true path is "C: Inetpubcgi-bin "Please set it to" implement. " In this way, you want to debug the CGI program copied to "C: Inetpubcgi-bin", you can use "http://hh/cig-bin/ program name. Cig" test your CGI program has. What, your CGI program can not be correctly now? Almost forgot an important event, that is, you have to install a PERL CGI interpreter ─ ─ PERL for Win32!

Third, install PERL for Win32

1, Download PERL For Win32 program: Pw32i316.exe, 1.47M.

It is a version of PERL For Win32, you can go to the "http://www.activestate.com" to download, there are many versions of PERL For Win32, you can go to download to my home, my home address : "http://comenet.yeah.net".

2, install PERL For Win32, this operation is relatively simple.

Executive Pw32i316.exe, it is a self-extracting compressed file, extract to "c: perl" automatically after installation, the system questions were:

(1). Do you wish to proceed? Enter "Y"

It will be added in the registry path information related to the PERL.

(2). Modify search path? Enter "Y"

It is set in the Autoexec.bat in the PERL path. After the restart the machine, according to my practice, should be able to run a CGI program.


3, compiled a simple PERL CGI program a try.

Create a new file with Notepad, named test.cgi (also named test.pl), then Copy the following code into, then save it to "c: inetpubcgi-bin" directory. The following example ,"#!/ usr / bin / perl "and unnecessary for this case, because the system to install Perl for Win32 Perl interpreter has joined the association, in actual use, if this program runs on UNIX hosts This phrase has specified Perl interpreter position, is essential.

#! / Usr / bin / perl


print "Content-type: text / htmlnn";


# Top of this statement is to specify the server protocol between the browser, this example specifies the output data type


# To text / html, is a HTML file


print "";


print "";


print "";


print "";


print " OK, a success! ";


print "";


exit; # exit


Open a browser, enter "http://hh/cig-bin/test.cgi", a success! .

Do not tell me you did not succeed, Well, if this is true, unfortunately, you have to adapt Win98 registry, and in fact this is no big deal, the two sentences.

Method is to run the registry editor "regedit", then click Open:

HKEY_LOCAL_MACHINESystemCurrentContrlSet ServicesW3SVCParametersScript Map, by adding ". Cgi'C: PERLBINperl.exe% s% s '" and ". Pl'C: PERLBINperl.exe% s% s'". Please note, "C: PERLBINperl.exe" after the installation Pw32i316.exe, perl.exe path. Quit Registry Editor, restart your computer, enter "c: inetpubcgi-bin" directory from select just created "test.cgi" file, double-click it, then the system will see a list of window asking what program to open it using kinds of files, found in the file list "perl (if you can not find the" other "item specified by path, which is" c: perlbinperl.exe "), and select" Always use the software to open this type The file "item, click" OK "button.

Note that in the case of the browser "OK, a success!" There will be a line "Content-type: text / html", it does not matter, when the CGI program to run on other operating systems, this sentence will disappear ! In addition, Win98/95 system does not support the flock PERL statement, encountered when you use the "#" it commented, the actual use and then recovered.

Fourth, and finally added

After the some operations, you will find, to dial the Internet has been inaccessible now. Do not worry, your property as long as IE browser's "connection" to "use a modem to connect to the Internet", you can also surf the Internet! At this point, you're done! As for Chinese Win95, operating similar.

Now you can, easily prepared in the local PERL CGI debugging their own programs, I feel really great!

ไม่มีความคิดเห็น:

แสดงความคิดเห็น