Home Backend Development PHP Tutorial 使用PWS调试cgi,php_PHP

使用PWS调试cgi,php_PHP

Jun 01, 2016 pm 12:32 PM
use database program debug

一、PWS下配置ActivePerl,使PWS支持CGI程序。

1.在Windows98下安装PWS4.0(Microsoft Personal Web Server 4.0 在Windows98系统光盘的add-ons目录下)。

2.下载APi522e.exe(Windows98下建议用这个),下载地址为:

http://www.cgiunion.net/perlsoft/APi522e.exe 、 http://www.activestate.com/ActivePerl/download/Api522e.exe 或者是 http://www.fykx.net/download/cgi/api522e.exe

3.安装APi522e.exe,建议安装在C:\USR目录下,因为每个CGI程序文件第一行都要申明CGI解释程序的路径(#!/usr/bin/perl)。

4.运行regedit (需要重新启动计算机才能生效)
找到: HKEY_LOCAL_MACHINE\System\Currentcontrlset
\Services\W3svc\Parameters\ScriptMap\ 目录
增加以下键值:
键名: ".cgi" 键值: "C:\USR\BIN\perl.exe %s %s"
键名: ".pl" 键值: "C:\USR\BIN\perl.exe %s %s"

5.为PWS添加虚拟目录(如下图),目录别名为:CGI-BIN,把访问属性设为:执行,目录位置为本地硬盘的任何目录(CGI程序就存放在这个目录中)。

6.编写测试程序:
文件test.cgi放在CGI-BIN这个目录下,代码如下
#!/usr/bin/perl
print "Content-type:text/html\n\n";
print "";
print "哈!哈!哈!我成功啦!!!";
在浏览器地址栏中键入http://127.0.0.1/cgi-bin/test.cgi
如果在浏览器中显示:哈!哈!哈!我成功啦!!!你就成功了。

7.有关出现错误文题的解决,以调试YuziBBS3000为例,把配置文件SETUP.CGI按要求设置好后开始运行,结果

出现如下错误:
CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The

headers it did return are:

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

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

上一段的中文意思为:
“CGI 错误
指定的 CGI 应用程序因为没有返回完整的 HTTP 标题而运行不正常。它返回的标题是:”

经过分析bbs.cgi程序代码,发现程序开始部分有require "setup.cgi";这么一句,这一句是程序对setup.cgi
配置文件发出请求,这种情况在Unix系统下不会出现错误,在Win98和NT系统下必须写明绝对路径,把这一句改

为:require "C:/Inetpub/wwwroot/cgi-bin/bbs3000/setup.cgi";再也不会出现错误,其他CGI文件也是如此


php运行环境的配置

一、下载最新版本的PHP解释程序
下载地址为: ftp://ftp.oso.com.cn/download/PHP/php-4.0.4-Win32.zip (3882KB) 或者是: http://www.fykx.net/download/php/php-4.0.4-Win32.zip

二、安装PHP解释程序

安装步骤:

1.将压缩包解压到C:\PHP这个目录下.

2.将“C:\php\dlls”目录下的所有文件复制到“c:\WinNT\System32(Winodws98系统为C:\Windows\System)”目录下,有旧的文件存在就覆盖它。

3.将C:\PHP\php.ini-dist这个文件改名为PHP.ini,复制到“C:\WinNT(Winodws98系统为C:\Windows)”目录下,并修改里面的内容,具体如下:
找到“extension_dir = ”改为“extension_dir=c:/php/extensions”
再稍微往下看,改成这个样子:
;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_cpdf.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_pdf.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

如果哪个库在运行时不正常,就在行首加上分号“;”.

4.修注册表。(需要重新启动计算机才能生效)
在HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w3svc\parameters\Script Map
增加以下键值:
键名: ".PHP" 键值: "C:\php\php.exe %s %s"

5.点击"开始->程序->管理工具->Internet 服务管理器"打开"Internet 服务管理器",右击"默认Web站点->属性"打开"默认Web站点属性"窗口,在"ISAPI筛选器"配置页下,添加一个新的筛选器,筛选器名称为PHP,可执行文件为php4isapi.dll文件的完整路径,如C:\php\sapi\php4isapi.dll;在"主目录"配置页下,按"配置"按钮打开"应用程序配置"窗口,添加一个应用程序映射项,可执行文件为php.exe,文件的完整路径
如C:\PHP\php.exe,扩展名为.php(当然也可以改成别的,不过要注意您的PHP程序要以它为后缀哦),把"脚本引擎"打上勾,重新启动电脑及WWW服务。

三、测试PHP运行环境

在站点目录下写一个测试程序test.php,内容为


MySQL数据库系统的安装和配置

一、下载MySQL数据库(ODBC)驱动程序和MySQL数据库系统程序

1.MySQL数据库(ODBC)驱动程序下载地址为: 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 或者 http://www.fykx.net/download/php/myodbc-2.50.36-nt.zip (1457KB)

2.MySQL数据库系统程序下载地址为: http://www.mysql.com/Downloads/MySQL-3.23/mysql-3.23.30-gamma-win.zip (9632KB)或者是 http://www.fykx.net/download/php/mysql-3.23.30-gamma-win.zip

二、程序安装

1.安装MySQL数据库(ODBC)驱动程序(Windows系统下必须安装)

2.安装MySQL数据库系统程序,一般安装在系统默认位置“C:\MySQL”,但要考虑你的服务器是否作为网络数据库服务器,如果要在此服务器上建立上百个数据库用户,就应该安装在空间比较大硬盘分驱上,以免今后不必要的麻烦和繁琐的设置。

三、程序的启动

执行“[系统安装盘符]:\MySQL\Bin\winmysqladmin.exe”这个程序来启动MySQL数据库系统和管理器,第一次启动时,系统会出现“快速设置”窗口,要求建立第一个数据库用户帐号,如下图。在User name中输入第一个MySQL数据库帐号的用户名,在Password中输入第一个MySQL数据库帐号的密码,最好你记住输入的值,然后进入MySQL数据库管理窗口,过一会儿程序自动最小化窗口到系统的托架处(任务栏的右边有个“红绿灯”图标),系统已经正常启动(Windows2000还要检查一下“组件服务管理器”中“MySQL组件服务”是否启动)。这时,程序还在启动组里添加了一个快捷方式,下次启动计算机就自动启动MySQL数据库系统。




四、数据库的建立

第一次启动数据库,系统就自动建立了名称为MySQL和test的两个数据库,你可以用以下的方法建立其它名称的数据库:

右键单击系统托架“红绿灯”图标=>>单击“Show me”打开MySQL数据库管理窗口=>>选择“Databases”标签=>>选择数据库服务器=>>右键单击一下=>>选择“Create database”菜单项=>>在弹出的添加数据库对话框中键入数据库名称(Database name)=>>单击“Create the datebase(创建这个数据库)”,一个新的数据库就建立了。如下图



五、数据库用户帐号管理

第一次启动数据库就建立了一个数据库用户帐号,如果你的服务器要让多个用户使用的话,就必须建立多个数据库用户帐号,步骤如下:

启动“ODBC 数据源管理器”(WindowsNT系统下“ODBC 数据源管理器”在“管理工具”里,Windows98 or Me系统下“ODBC 数据源管理器”在“控制面板”里)=>>在第一个标签“用户DSN”中单击“添加”按钮=>>在数据源驱动程序列表中选择“MySQL”=>>单击“完成”按钮=>>在“数据库驱动程序配置”对话框“Windows DSN name”中填入“动感教育网”(表示为动感教育网开的帐号),在MySQL host(Name or IP)填入服务器的主机名或者IP地址,在MySQL database name中填入数据库名称,在User中填入数据库帐号的用户名,在Password中填入数据库帐号的密码,其它的为默认设置=>>单击“OK”。一个新的数据库帐号就建立起来了。





六、调试程序(以版面风格美化后的vBulletin Version 1.1.5 中文标准版为代理例)

1.修改Admin/Config.php文件,具体内容如下:


// 目前只支持MySQL
$dbservertype="mysql";
// hostname或服务器ip
$servername="localhost";
// 登录数据库的用户名和密码
$dbusername="xiaozhang";
$dbpassword="123456";
// 数据库名
$dbname="mysql";
//允许在控制面板查看/编辑密码
// 0 = 不可见或编辑
// 1 = 不可见,但可以编辑
// 2 = 可见和可以编辑
$pwdincp=2;

?>

2.安装这个论坛系统

http://你的域名/论坛目录/admin/install.php,然后按照向导进行安装即可,论坛演示地址为http://www.activeedu.net/php/vb141/index.php。

至于这个论坛的详细配置在这里不作说明了,以后有时间再写这方面的文章。

摘自:http://sxren.dhs.org/
作者:不祥

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to use LeakSanitizer to debug C++ memory leaks? How to use LeakSanitizer to debug C++ memory leaks? Jun 02, 2024 pm 09:46 PM

How to use LeakSanitizer to debug C++ memory leaks? Install LeakSanitizer. Enable LeakSanitizer via compile flag. Run the application and analyze the LeakSanitizer report. Identify memory allocation types and allocation locations. Fix memory leaks and ensure all dynamically allocated memory is released.

How to conduct concurrency testing and debugging in Java concurrent programming? How to conduct concurrency testing and debugging in Java concurrent programming? May 09, 2024 am 09:33 AM

Concurrency testing and debugging Concurrency testing and debugging in Java concurrent programming are crucial and the following techniques are available: Concurrency testing: Unit testing: Isolate and test a single concurrent task. Integration testing: testing the interaction between multiple concurrent tasks. Load testing: Evaluate an application's performance and scalability under heavy load. Concurrency Debugging: Breakpoints: Pause thread execution and inspect variables or execute code. Logging: Record thread events and status. Stack trace: Identify the source of the exception. Visualization tools: Monitor thread activity and resource usage.

iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos Jul 18, 2024 am 05:48 AM

Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

Detailed tutorial on establishing a database connection using MySQLi in PHP Detailed tutorial on establishing a database connection using MySQLi in PHP Jun 04, 2024 pm 01:42 PM

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())

How to handle database connection errors in PHP How to handle database connection errors in PHP Jun 05, 2024 pm 02:16 PM

To handle database connection errors in PHP, you can use the following steps: Use mysqli_connect_errno() to obtain the error code. Use mysqli_connect_error() to get the error message. By capturing and logging these error messages, database connection issues can be easily identified and resolved, ensuring the smooth running of your application.

How to debug PHP asynchronous code How to debug PHP asynchronous code May 31, 2024 am 09:08 AM

Tools for debugging PHP asynchronous code include: Psalm: a static analysis tool that can find potential errors. ParallelLint: A tool that inspects asynchronous code and provides recommendations. Xdebug: An extension for debugging PHP applications by enabling a session and stepping through the code. Other tips include using logging, assertions, running code locally, and writing unit tests.

What is Bitget Launchpool? How to use Bitget Launchpool? What is Bitget Launchpool? How to use Bitget Launchpool? Jun 07, 2024 pm 12:06 PM

BitgetLaunchpool is a dynamic platform designed for all cryptocurrency enthusiasts. BitgetLaunchpool stands out with its unique offering. Here, you can stake your tokens to unlock more rewards, including airdrops, high returns, and a generous prize pool exclusive to early participants. What is BitgetLaunchpool? BitgetLaunchpool is a cryptocurrency platform where tokens can be staked and earned with user-friendly terms and conditions. By investing BGB or other tokens in Launchpool, users have the opportunity to receive free airdrops, earnings and participate in generous bonus pools. The income from pledged assets is calculated within T+1 hours, and the rewards are based on

PHP Debugging Errors: A Guide to Common Mistakes PHP Debugging Errors: A Guide to Common Mistakes Jun 05, 2024 pm 03:18 PM

Common PHP debugging errors include: Syntax errors: Check the code syntax to make sure there are no errors. Undefined variable: Before using a variable, make sure it is initialized and assigned a value. Missing semicolons: Add semicolons to all code blocks. Function is undefined: Check that the function name is spelled correctly and make sure the correct file or PHP extension is loaded.

See all articles