脚本头过早结束

Premature end of script headers

今天我尝试在 Windows10 上使用 BrookFramework 和 Lazarus 2.0.6。它编译一切都很好(我尝试了简单的 FastCGI 应用程序),但是当我尝试打开文件时“http://localhost/cgi-bin/test.fbf”它说 "Error 500: Premature end of script headers"。所有其他脚本都可以正常工作。

我正在使用 XAMPP,这是我刚刚安装的,所以最新版本的所有内容都应该是 运行。 我想我错过了一些配置,但我找不到它。

谢谢

我是这样解决的:我将 "Hello World" 示例复制到我的项目文件夹并重命名。现在可以了。这是完全相同的代码,所以我想我错过了 Lazarus 内部的配置。

有一种在 apache 上 运行 / compile+运行 .pas 脚本的最快方法 +php 。 创建了文件夹“c:\htdocs\myapp”,其中包含这些文件:

index.php

<?php
!file_exists('index.exe') and exec('c:\lazarus\fpc.2.2\bin\x86_64-win64\fpc.exe '.realpath('.').'\index.pas');
system('index.exe');
?>

index.pas

program p;
begin
writeln('hehehe');
end.

只需调用 http://localhost/myapp 即可编译 首先 你的 .pas 然后将执行生成的 exe .. 即使不发送 header Content-type: text/html\r\n 先!