apache24不会运行cgi脚本

时间:2015-07-18 17:41:30

标签: apache perl

httpd-error.log

[Sat Jul 18 17:30:22.505894 2015] [cgi:error] [pid 30498] [client 24.224.147.251:40394] AH01215: env: perl: No such file or directory: /srv/http/forum.fgfugees.ca/htdocs/cgi-bin/test.cgi

[Sat Jul 18 17:30:22.505987 2015] [cgi:error] [pid 30498] [client 24.224.147.251:40394] End of script output before headers: test.cgi

该文件确实存在,我可以通过键入

成功运行它
/usr/bin/env perl /srv/http/forum.fgfugees.ca/htdocs/cgi-bin/test.cgi 

进入我的CLI。

httpd.conf:http://pastebin.com/MGGFNcyQ

我在forum.fgfugees.ca虚拟主机下测试脚本,该主机从第287行开始

该脚本位于:/srv/http/forum.fgfugees.ca/htdocs/cgi-bin /

test.cgi:

#!/usr/bin/env perl

print "Content-type: text/html\n\n";
print "sup bitch";

2 个答案:

答案 0 :(得分:0)

在shell的登录脚本中,您可以更改PATH,允许从您的shell中找到// NODE import http from 'http'; import path from 'path'; // EXPRESS import express from 'express'; import favicon from 'serve-favicon'; import httpProxy from 'http-proxy'; const proxy = httpProxy.createProxyServer(); // Profile dev or production let profile = process.env.DEV ? 'dev' : 'prod', publicPath = profile === 'dev' ? 'build' : 'dist'; let app = express(); app.set('port', process.env.PORT || 3000); app.use(express.static(publicPath)); app.use(favicon(path.join(__dirname, '../app/images/favicon.ico'))); // // Register middlewares // -------------------- // renderer let renderer = require('./routes/renderer'); // // Configure middlewares // -------------------- renderer.init(profile); // // Activate middlewares // -------------------- // app.use('/api/*', (req, res) => { proxy.web(req, res, { target: 'http://laravel.app:80' }); }); app.use(renderer.render); http.createServer(app).listen(app.get('port'), () => { console.log('Express server listening on port ' + app.get('port')); }); // // check if HMR is enabled // -------------------- if(module.hot) { // accept update of dependency module.hot.accept(['./routes/api', './routes/renderer'], () => { app.use('/api/*', (req, res) => { proxy.web(req, res, { target: 'http://laravel.app:80' }); }); renderer = require('./routes/renderer'); renderer.init('dev'); }); } 。但只能从你的shell。取代

perl
在shebang行中的

以及/usr/bin/env perl 的实际路径。

perl

type -p perl

可以帮助您确定该路径是什么。

答案 1 :(得分:-1)

由于某种原因,Apache无法运行/ usr / bin / env perl。

我使用shebang行#!/usr/local/bin/perl取代了某种权限错误