2015-11-03 130 views
0

我通常使用主機來安裝站點,並且它們與CGI一起工作。需要使用CGI運行位於cgi-bin中的文件

Server API CGI/FastCGI 

現在我安裝在AWS EC2實例的站點使用Ubuntu 14.04和Apache 2.4跟着一些教程安裝FastCGI的,現在我在我的PHP信息此配置:

Server API FPM/FastCGI 

當我嘗試訪問到/ var/www/html等/ cgi-bin目錄我找到文件,改變了所有的權限,試圖執行它們,但我得到這個錯誤:

[cgi:error] [pid 5951:tid 140061935601408] [client 186.67.242.72:22739] script not found or unable to stat: /usr/lib/cgi-bin/test.cgi 

我想excecute該文件是LOCAT編輯於/var/www/html/cgi-bin/test.php

#!/usr/bin/perl 
use strict; 
use CGI; 
print "content-type: text/html\n\n"; 
print "Prueba CGI!\n"; 

請幫忙!

回答

0

日誌信息保存答案:

script not found or unable to stat: /usr/lib/cgi-bin/test.cgi

如果你檢查你的Apache配置你應該注意到了/cgi-bin一個ScriptAlias/usr/lib/cgi-bin。你可以解決這個問題:

  1. 將CGI腳本在/usr/lib/cgi-bin
  2. 變化在/var/www/html虛擬主機ScriptAlias/var/www/html/cgi-bin並重新啓動Apache
  3. 設置爲cgi-bin目錄的CGI選項和處理程序和重新啓動Apache