Linux下Apache配置cgi
来源:互联网 发布:linux ip扫描工具 编辑:程序博客网 时间:2024/04/30 07:20
基本的配置步骤我就不说了,谈谈我遇到的问题,分享一些比较有用的解决办法。
步骤一:按教程搭建
搭建简易的c语言CGI和Apache服务器的开发环境
上面这篇文章,不仅有相应的步骤,而且还分享了源代码,比较实在。步骤二:碰到Internal Server Error错误,并试图解决
在按照要求配置了之后,启动服务器测试,发现服务器提示如下的错误,相信很多初次配置的人对这个界面很讨厌。
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, you@example.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Apache/2.0.64 (Unix) Server at ***.***.***.*** Port 80
步骤三:查找错误一Permission denied并解决
- 查看Linux下apache的一般安装目录为:/usr/local/apache2/bin
- 查看错误日志的说明:/usr/local/apache2/logs/error_log
- 提示如下错误
- [error] (13)Permission denied: exec of /usr/local/apache2/cgi-bin/test-cgi failed
[error] [client xxx.xxx.xxx.xxx] Premature end of script headers:
-rwxr-xr-x 1 root root 31900 03-04 15:49 libAVAPIs.so
-rwxr-xr-x 1 root root 72876 03-04 15:49 libIOTCAPIs.so
-rwxr-xr-x 1 root root 18056 03-04 15:49 libRDTAPIs.so
-rwxr----- 1 root root 160 04-28 10:04 Makefile
-rw-r--r-- 1 c7user c7user 294 2005-02-04 printenv
-rwxr-xr-x 1 root root 8295 04-28 11:07 SetPass
-rw-r--r-- 1 root root 4389 04-28 13:53 setpass.c
-rwxr-xr-x 1 c7user c7user 779 2005-02-04 test-cgi
步骤四:查找错误二error while loading shared libraries并解决
在错误日志中查看,提示如下:
[Mon Apr 29 20:00:41 2013] [error] [client 222.201.146.139] /usr/local/apache2/cgi-bin/SetPass: error while loading shared libraries: libIOTCAPIs.so: cannot open shared object file: No such file or directory
这个问题有两个解决办法:
error while loading shared libraries: xxx.so.x"错误的原因和解决办法
请记住,在把***.so上传到/usr/local/lib后,记得修改so文件的执行权限(chmod 755 filename)
步骤五:查找错误三Premature end of script headers并解决
在调用cgi后首先输出:Content-type:text/html\n\n
步骤六:调用cgi带有参数
http://121.14.119.122:8090/cgi-bin/test-cgi?we+wwerq+1234
输出如下:
CGI/1.0 test script report:argc is 3. argv is we wwerq 1234.SERVER_SOFTWARE = Apache/2.0.64 (Unix)SERVER_NAME = 121.14.119.122GATEWAY_INTERFACE = CGI/1.1SERVER_PROTOCOL = HTTP/1.1SERVER_PORT = 8090REQUEST_METHOD = GETHTTP_ACCEPT = text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8PATH_INFO = PATH_TRANSLATED = SCRIPT_NAME = /cgi-bin/test-cgiQUERY_STRING = we+wwerq+1234REMOTE_HOST =REMOTE_ADDR = 222.201.146.139REMOTE_USER =AUTH_TYPE =CONTENT_TYPE =CONTENT_LENGTH =
参考文献:
Perl CGI Debugging: Solving a 500 Internal Server Error
Running CGI's from User Home Directories
- Linux下Apache配置cgi
- Linux下Apache+cgi的配置方法
- Linux Apache CGI 配置
- [Apache手册]Linux环境下配置Apache运行cgi
- mac下 apache cgi 配置
- linux 下 apache php-cgi 安装及配置
- linux 下 apache php-cgi 安装及配置
- Linux下 Apache服务器配置CGI(perl)
- linux Apache CGI 安装配置
- Linux下Apache+cgi的配置方法。(转) ---设置cgi-bin
- Linux下Apache+cgi的配置方法。(转) ---设置cgi-bin
- Linux下Apache+cgi的配置方法。(转) ---设置cgi-bin
- Linux下配置cgi环境
- windows下配置apache以运行CGI
- ubuntu下apache+C语言+CGI配置
- Windows下配置Apache+python cgi
- Windows下配置apache运行cgi程序
- Windows下配置Apache+python cgi
- 让移动硬盘windows2003自动无法识别
- 详解WinCE下USB Host驱动开发(1)
- 华为上机(3)
- C++经典类库(C++开发必看)
- 在WinCE 6.0系统下实现USB功能定制
- Linux下Apache配置cgi
- HDU 2099 整数的尾数
- 串连字符串strcat
- 问题一百零一十:数列求和
- 搜索的分类及八数码问题
- 几个常见的关于日期的SQL
- Hadoop字符转码的实现
- Hadoop+HBase+ZooKeeper三者关系图
- USACO 1.1.2 Greedy Gift Givers