Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/clojure/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
尝试在Apache[Cloud9IDE]上打开文件时,在头之前结束脚本输出_C_Apache_Cgi - Fatal编程技术网

尝试在Apache[Cloud9IDE]上打开文件时,在头之前结束脚本输出

尝试在Apache[Cloud9IDE]上打开文件时,在头之前结束脚本输出,c,apache,cgi,C,Apache,Cgi,我尝试在CGI bin(~/workspace/files/html)之外使用CGI C编辑文件,并尝试使用以下代码打开文件(编辑的工作空间名称和用户): 我收到一个内部服务器错误,当我检查错误日志时,它显示: [Wed Oct 05 18:40:12.350766 2016] [cgi:error] [pid 28008] [client 10.240.0.213:54468] End of script output before headers: test.cgi, referer: ht

我尝试在CGI bin(~/workspace/files/html)之外使用CGI C编辑文件,并尝试使用以下代码打开文件(编辑的工作空间名称和用户):

我收到一个内部服务器错误,当我检查错误日志时,它显示:

[Wed Oct 05 18:40:12.350766 2016] [cgi:error] [pid 28008] [client 10.240.0.213:54468] End of script output before headers: test.cgi, referer: https://workspacename-user.c9users.io/files/html/main.html
我尝试将试图打开的文件的位置直接更改到cgi bin:

pfile = fopen("output.html", "w");

这似乎奏效了。有办法解决这个问题吗?

事实证明,fopen不能接受URL。我尝试编辑代码以:

pfile = fopen("../../../home/ubuntu/workspace/files/html/output.html", "w");

它成功了。

你不能
fopen()。您需要为其提供一个正常的文件系统路径。“
fopen
接受在执行时在文件系统上有效的路径”。
pfile = fopen("../../../home/ubuntu/workspace/files/html/output.html", "w");