0
當我嘗試執行CGI時,它只給出純文本。執行CGI時,只給我明文
我的Apache2 安裝PHP5.3.11他們都被手動安裝從源代碼,而不是從易於得到
## Apache2
./configure --prefix/=usr/loca/apache2
make
make install
## php5
./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs
make
make test
make install
以上是我用來安裝的Apache2和PHP5的命令。 我想我的安裝apache2和php5是正確的,因爲我可以在我的服務器上運行php代碼。所以我試圖正確執行CGI腳本,我想是設置一個配置。 但它只顯示純文本的CGI腳本。
###Start###
#!/usr/bin/perl -w
print "Content-type: text/html\r\n\r\n";
print "Hello there!<br />\nJust testing .<br />\n";
for ($i=0; $i<10; $i++){
print $i."<br />";
}
###End###
perl正確安裝在/ usr/bin/perl。
我設置了我的httpd.conf,如下所示。
<Directory "/usr/local/apache2/cgi-bin">
Options +ExecCGI
AddHandler cgi-script .cgi .pl
Require all granted
</Directory>
我認爲cgi-php5安裝正確,因爲當我執行「php-cgi -h」時,它給了我一個結果。 當我通過瀏覽器打開phpinfo(), GATEWAY_INTERFACE設置爲CGI/1.1
我失蹤的任何事情?我很感謝你的幫助。