在安裝 CGI 程式時如果設定錯誤,便會看到 "500 Internal Server Error" 訊息,一般常見的錯誤可以用以下方法解決:

1. CGI 程式的權限需要設定為 711 或 755。

2. 程式的最開端有一行類似 #!/usr/bin/perl,其中 #! 是必需要的,然後確定 /usr/bin/perl 是正確的路徑,另外這行前不可以有空格或空行。

3. 如果程式本身會讀寫其他檔案,要檢查存取檔案的絕對路徑或相對路徑是否正確,以及檔案是否有權限存取。

4. 根據 HTTP 栛定,在輸出內容前要先輸出 HTTP Headers,否則便會遇上便會錯誤,在 Apache 的 error log 裡面看到的錯誤是 "Premature end of script headers",解決方法是在輸出內容前加一句:

print ("Content-Type: text/html;\n\n");

如大家發現有錯漏,或者有其他補充,觀迎回覆指教。

以上为网络解决:

问题:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>500 Internal Server Error</title> </head> <body> <h1>Internal Server Error</h1> <p>The server encountered an internal error ormisconfiguration and was unable to completeyour request.</p> <p>Please contact the server administrator, webmaster@localhost and inform them of the time the error occurred,and anything you might have done that may havecaused the error.</p>

<p>More information about this error may be availablein the server error log.</p> <hr><address>Apache/2.2.22 (Ubuntu) Server at 192.168.8.111 Port 80</address>< /body> </html>

解决:

添加:

printf ("Content-Type: text/html;\n\n");

即可

CGI "Internal Server Error"的更多相关文章

  1. Apache Internal Server Error

    当使用 Apache 作为服务器,使用 cgi 程序接收来自 web 端的访问时,出现如下错误: Internal Server Error The server encountered an int ...

  2. PHP如何让apache支持.htaccess 解决Internal Server Error The server …错误

    TP框架  打开 www.newtp.com/index.php/Home/Index/abc出现 如下错误: Internal Server Error The server encountered ...

  3. mvcmovie sample 在window10 下的部署问题(HTTP Error 500.19 - Internal Server Error)

    mvcmovie sample 在window10 下的部署问题 使用VS2018配置好了mvcmovie sample,发布到IIS后,打开报错: HTTP Error 500.19 - Inter ...

  4. EBS Webservice Timeout,HTTP Server Return "500 Internal Server Error"

    http://blog.itpub.net/26687597/viewspace-1207571/ 基于Oracle EBS R12,开发了一个Webservice用于返回某项主数据,当请求的数据量非 ...

  5. 如何让apache支持.htaccess 解决Internal Server Error The server …错误

    如何让apache支持.htaccess 解决Internal Server Error The server …错误 文章来源:小灰博客| 时间:2013-12-25 12:17:08| 作者:Le ...

  6. HTTP 错误 500.21 - Internal Server Error 解决方案

    不久前重新安装了Windows7,在安装了VS2010 开发平台之后,将网站发布到IIS,访问发生如下错误: HTTP 错误 500.21 - Internal Server Error处理程序“Ni ...

  7. HTTP 错误 500.21 - Internal Server Error 处理程序“PageHandlerFactory-Integrated”在其模块列表中有一个错误模块“ManagedPipelineHandler”

    HTTP 错误 500.21 - Internal Server Error 处理程序“PageHandlerFactory-Integrated”在其模块列表中有一个错误模块“ManagedPipe ...

  8. <<< php程序在运行后报“internal server error”错误

    上传的php程序在运行后报“internal server error”错误,检查以下两方面: 1.请您检查php程序的属性是否设置为755,如果php程序的属性不是755,那么运行的时候会报“int ...

  9. HTTP 错误 500.23 - Internal Server Error

    HTTP 错误 500.23 - Internal Server Error 检测到在集成的托管管道模式下不适用的 ASP.NET 设置. IIS8.0详细错误 老版本WEB程序用 VS2013打开时 ...

随机推荐

  1. 集合(python)

    # -*- coding: utf-8 -*- class Array(object): def __init__(self, size=32, init=None): self._size = si ...

  2. 【HDU-1045,Fire Net-纯暴力简单DFS】

    原题链接:点击!   大致题意:白块表示可以放置炮台的位置——每个炮台可以攻击到上下左右的直线上的炮台(也就是说在它的上下左右直线上不可以再放置炮台,避免引起互相攻击),黑块表示隔离墙的位置——不可放 ...

  3. webpack 配置react脚手架(四):路由配置

    1. 由于 react-router 是集成了 react-router-dom 和 react-router-native的一起的,所以这里要使用的是 react-router-dom, 2. 安装 ...

  4. machine learning(9) -- classification:Decision boundary

    machine learning(9) -- classification:Decision boundary 上图的decision boundary是一条直线,是属于预测函数的一个属性(当参数已经 ...

  5. 如何在C中传递二维数组作为参数?

    回答: 在C语言中,有很多方法可以将2d数组作为参数传递.在下面的部分中,我描述了将2d数组作为参数传递给函数的几种方法. 使用指针传递2d数组以在c中运行 多维数组的第一个元素是另一个数组,所以在这 ...

  6. MongoDB 副本集的常用操作及原理

    本文是对MongoDB副本集常用操作的一个汇总,同时也穿插着介绍了操作背后的原理及注意点. 结合之前的文章:MongoDB副本集的搭建,大家可以在较短的时间内熟悉MongoDB的搭建和管理. 下面的操 ...

  7. java实现大视频上传

    javaweb上传文件 上传文件的jsp中的部分 上传文件同样可以使用form表单向后端发请求,也可以使用 ajax向后端发请求 1.通过form表单向后端发送请求 <form id=" ...

  8. svn diff 只显示文件名

    svn diff   --summarize

  9. splay 1296 营业额统计

    有一个点超时,确实是个很简单的splay#include<cstdio> #include<iostream> using namespace std; int n,shu[1 ...

  10. IDEA中获取资源路径问题

    更正 以src开始,就能用相对路径了... shift+ctrl+alt+s 调出项目结构, 在Modules里,就是设置 Sources Resources Test的界面, 右面的路径就是相对路径 ...