Use PWS to debug CGI and PHP

Source: Internet
Author: User

Introduction: This is a detailed page for using PWS to debug CGI and PHP. It introduces related knowledge, skills, experience, and some PHP source code.

Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 324398 'rolling = 'no'>

1. Configure ActivePerl in PWS to enable PWS to support CGIProgram.

1. Install pws4.0 on Windows 98 (Microsoft Personal Web Server 4.0 is under the add-ons directory on Windows 98 System disc ).

2.download api522e.exe (this is recommended for Windows 98), which is:

Http://www.cgiunion.net/perlsoft/APi522e.exe, http://www.activestate.com/ActivePerl/download/Api522e.exe, or http://www.fykx.net/download/cgi/api522e.exe

3.install api522e.exe. We recommend that you install it in the C: \ USR directory, because the path of the CGI interpreter (#! /Usr/bin/perl ).

4. Run regedit (the computer needs to be restarted to take effect)
Locate: HKEY_LOCAL_MACHINE \ SYSTEM \ currentcontrlset
\ Services \ W3SVC \ Parameters \ scriptmap \ directory
Add the following key values:
Key name: ". cgi" key value: "C: \ USR \ bin \ perl.exe % S % s"
Key name: ". pl" key value: "C: \ USR \ bin \ perl.exe % S % s"

5. add a virtual directory (such as) for PWS, the directory alias is: CGI-BIN, set the access attribute to: Execute, the directory is located in any directory of the local hard disk (the CGI program is stored in this directory ).

6. Compile the test program:
Put the file test. cgi in the CGI-BIN directory,CodeAs follows:
#! /Usr/bin/perl
Print "Content-Type: text/html \ n ";
Print "";
Print "Ha! Ha! Ha! I succeeded !!! ";
Type http: // 127.0.0.1/cgi-bin/test. cgi in the address bar of the browser.
If: Ha! is displayed in the browser! Ha! Ha! I succeeded !!! You have succeeded.

7. For troubleshooting of the error message, take the debugging yuzibbs3000 as an example. Set the configuration file setup. cgi as required and then start running.

The following error occurs:
CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers.

Headers it did return are:

Can't locate setup. cgi in @ INC (@ INC contains: C:/usr/lib C:/usr/site/lib.)

C: \ Inetpub \ wwwroot \ cgi-bin \ bbs3000 \ BBs. cgi line 9.

The Chinese meaning of the previous section is:
"CGI Error
The specified CGI application does not run properly because it does not return the complete HTTP title. It returns the following title :"

After analyzing the code of the BBS. cgi program, it is found that require "setup. cgi" is at the beginning of the program.
The configuration file sends a request. In this case, no errors will occur in Unix systems. In WIN98 and NT systems, the absolute path must be specified.

Is: require "C:/inetpub/wwwroot/cgi-bin/bbs3000/setup. cgi"; no errors will occur again, as will other cgi files

PHP runtime environment Configuration

1. download the latest PHP interpreter
Is: ftp://ftp.oso.com.cn/download/PHP/php-4.0.4-Win32.zip (3882kb) or: http://www.fykx.net/download/php/php-4.0.4-Win32.zip

Ii. Install the PHP interpreter

Installation steps:

1. decompress the compressed package to the C: \ PHP Directory.

2. copy all files in the "C: \ PHP \ DLLs" directory to the "C: \ winnt \ SYSTEM32 (the winodws98 system is C: \ WINDOWS \ SYSTEM)" directory, if an old file exists, it will be overwritten.

3. set c: \ PHP. the ini-Dist file is renamed as PHP. INI, copy it to the "C: \ WINNT (the winodws98 system is C: \ Windows)" directory, and modify the content as follows:
Change "extension_dir =" to "extension_dir = C:/PHP/extensions"
Let's take a look at it and change it to the following:
Windows extensions
; Note that MySQL and ODBC support is now built in, so no DLL is needed for it.
;
Extension = php_bz2.dll
Extension = php_ctype.dll
Extension = php_c2.16.dll
Extension = php_curl.dll
Extension = php_cybercash.dll
Extension = php_db.dll
Extension = php_dba.dll
Extension = php_dbase.dll
Extension = php_domxml.dll
Extension = php_dotnet.dll
Extension = php_exif.dll
Extension = php_fdf.dll
Extension = php_filepro.dll
Extension = php_gd.dll
Extension = php_gettext.dll
; Extension = php_ifx.dll
Extension = php_iisfunc.dll
Extension = php_imap.dll
Extension = php_interbase.dll
Extension = php_java.dll
Extension = php_ldap.dll
Extension = php_mhash.dll
; Extension = php_mssql65.dll
Extension = php_mssql70.dll
; Extension = php_oci8.dll
Extension = php_openssl.dll
; Extension = php_oracle.dll
Extension = php_cmd.dll
Extension = php_pgsql.dll
Extension = php_printer.dll
Extension = php_sablot.dll
; Extension = php_snmp.dll
; Extension = php_sybase_ct.dll
Extension = php_yaz.dll
Extension = php_zlib.dll

If the database is not running properly, add a semicolon (;) at the beginning of the row.

4. Modify the registry. (The computer must be restarted to take effect)
In the HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ W3SVC \ Parameters \ Script Map
Add the following key values:
Key name: ". php" key value: "C: \ PHP \ php.exe % S % s"

5. click Start> program> Administrative Tools> Internet Service Manager to open Internet Service Manager ", right-click "Default web site-> Properties" to open the "Default web site properties" window. On the "ISAPI filter" configuration page, add a new filter named PHP, the executable file is php4isapi. the complete path of the DLL file, such as c: \ PHP \ SAPI \ php4isapi. DLL. On the "main directory" configuration page, click "Configure" to open the "Application configuration" window. The executable file is php.exe, and the complete path of the file is used.
For example, c: \ PHP \ php.exe with the extension. PHP (you can also change it to something else, but note that your PHP program should use it as the suffix), tick the "Script Engine", and restart the computer and WWW Service.

Iii. Test the PHP Runtime Environment

Write a test program test. php In the site directory. The content is

Install and configure the MySQL database system

1. Download the MySQL database (ODBC) driver and MySQL Database System Program

1. MySQL database (ODBC) DRIVER: http://mysql.com/Downloads/MyODBC/myodbc-2.50.36-nt.zip, http://download.sourceforge.net/pub/mirrors/mysql/Downloads/MyODBC/myodbc-2.50.36-nt.zip or http://www.fykx.net/download/php/myodbc-2.50.36-nt.zip (1457kb)

2. the MySQL database system program is: http://www.mysql.com/Downloads/MySQL-3.23/mysql-3.23.30-gamma-win.zip (96 32 KB) or http://www.fykx.net/download/php/mysql-3.23.30-gamma-win.zip

Ii. Program Installation

1. Install the MySQL database (ODBC) Driver (required in Windows)

2. install the MySQL database system program. It is generally installed in the default system location "C: \ mysql". However, consider whether your server is used as a network database server, if you want to create hundreds of database users on this server, you should install them on hard drive with large space to avoid unnecessary troubles and complicated settings in the future.

3. Program startup

Run the "[system installation drive letter]: \ mysql \ bin \ winmysqladmin.exe" program to start the MySQL database system and manager. When the system is started for the first time, the "quick Settings" window appears, you must create the first database user account, such. Enter the username of the first MySQL database account in user name, and enter the password of the first MySQL database account in password. Remember the entered value and enter the MySQL database management window, after a while, the program automatically minimizes the window to the system bracket (there is a "traffic light" icon on the right of the taskbar ), the system has started properly (Windows2000 also needs to check whether "MySQL component service" in "Component Service Manager" is started ). At this time, the program also adds a shortcut in the startup group. The next time you start the computer, the MySQL database system will be automatically started.

Iv. database creation

When you start the database for the first time, the system automatically creates two databases named MySQL and test. You can use the following method to create a database named another one:

Right-click the system bracket "traffic light" icon >>> click "show me" to open the MySQL database management window >>> select the "databases" tag >>> select database server >>right click click ==>> select "create database" menu item >>> in the displayed add database dialog box, type the database name) >>> Click Create the Datebase to create a new database. For example

V. Database User Account Management

The first time you start the database, you have created a database user account. If your server needs to be used by multiple users, you must create multiple database user accounts as follows:

Start "ODBC data source Manager" ("ODBC data source Manager" under WindowsNT system is in "Administrative Tools", "ODBC data source Manager" under Windows98 or me system is in "Control Panel) >>> click "add" in the first tag "User DSN" ==>> select "MySQL" in the data source driver list> click "finish" =>> in the "database driver configuration" dialog box "Windows DSN name", enter "Dynamic Education Network" (an account opened by Dynamic Education Network ), enter the host name or IP address of the server in MySQL host (name or IP), Database Name in MySQL database name, and database account name in user, enter the password of the database account in the password, and set the other to the default value >>> click "OK ". A new database account is created.

6. debug the program (take VBulletin version 1.1.5 Chinese Standard Edition After the layout is beautified as an example)

1. Modify the admin/config. php file as follows:

// Currently, only MySQL is supported
$ Dbservertype = "MySQL ";
// Hostname or server IP Address
$ Servername = "localhost ";
// Username and password used to log on to the database
$ Dbusername = "Xiaozhang ";
$ Dbpassword = "123456 ";
// Database Name
$ Dbname = "MySQL ";
// Allows you to View/Edit the password on the control panel
// 0 = invisible or edited
// 1 = invisible, but editable
// 2 = visible and editable
$ Pwdincp = 2;

?>

2. Install the Forum System

Http: // your domain name/Forum directory/admin/install. php, and then follow the Wizard to install it. The Forum demo address is http://www.activeedu.net/php/vb141/index.php.

As for the detailed configuration of this forum, I will not describe it here. I will try again later.Article.

From: http://sxren.dhs.org/
Author: ominous

More articles on "using PWS to debug CGI and PHP"

Love J2EE follow Java Michael Jackson video station JSON online tools

Http://biancheng.dnbcw.info/php/324398.html pageno: 15.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.