Configuring Apache 2.4 for CGI on FreeBSD
I am trying to run CGI on FreeBSD 9.2.
- I installed Apache 2.4 (
pkg install apache24
) - Configured it to load CGI module.
- Also, I did
chmod a+x
on files incgi-bin
directory.
And when I connect to the server to a test CGI script, the server printed this error message.
AH01215: (13)Permission denied: exec of '/usr/local/www/apache24/cgi-bin/test-cgi' failed
End of script output before headers: test-cgi
What's wrong and how to fix this problem?
freebsd apache-httpd cgi
bumped to the homepage by Community♦ 34 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I am trying to run CGI on FreeBSD 9.2.
- I installed Apache 2.4 (
pkg install apache24
) - Configured it to load CGI module.
- Also, I did
chmod a+x
on files incgi-bin
directory.
And when I connect to the server to a test CGI script, the server printed this error message.
AH01215: (13)Permission denied: exec of '/usr/local/www/apache24/cgi-bin/test-cgi' failed
End of script output before headers: test-cgi
What's wrong and how to fix this problem?
freebsd apache-httpd cgi
bumped to the homepage by Community♦ 34 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I am trying to run CGI on FreeBSD 9.2.
- I installed Apache 2.4 (
pkg install apache24
) - Configured it to load CGI module.
- Also, I did
chmod a+x
on files incgi-bin
directory.
And when I connect to the server to a test CGI script, the server printed this error message.
AH01215: (13)Permission denied: exec of '/usr/local/www/apache24/cgi-bin/test-cgi' failed
End of script output before headers: test-cgi
What's wrong and how to fix this problem?
freebsd apache-httpd cgi
I am trying to run CGI on FreeBSD 9.2.
- I installed Apache 2.4 (
pkg install apache24
) - Configured it to load CGI module.
- Also, I did
chmod a+x
on files incgi-bin
directory.
And when I connect to the server to a test CGI script, the server printed this error message.
AH01215: (13)Permission denied: exec of '/usr/local/www/apache24/cgi-bin/test-cgi' failed
End of script output before headers: test-cgi
What's wrong and how to fix this problem?
freebsd apache-httpd cgi
freebsd apache-httpd cgi
edited Nov 24 '16 at 19:32
Fedor Dikarev
993310
993310
asked Jan 18 '14 at 9:17
Eonil
1,52262128
1,52262128
bumped to the homepage by Community♦ 34 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 34 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
The problem is shell. Apache 4.2's test CGI scripts are written for bash
, and FreeBSD comes with default shell csh
. The scripts are not compatible with csh
, so it fails, and Apache spits an error.
To fix this, (1) install bash
, and (2) add shebang to specify bash location.
Because FreeBSD userland is explicitly separated from base, installed bash will be placed in /usr/local/bin
rather than /bin
. So add a shebang like this.
#!/usr/local/bin
And then, the script will work well.
1
I'm not sure this is quite correct. It's been a long time since I've run Apache but I recall the same error the first time I tried it and switching shells, in this way, was not the solution. If you notice the error says, "Permission denied..." which is not an error from using the wrong shell and installing a package should have resolved that if the shell was the problem.
– Rob
Apr 15 '15 at 12:21
add a comment |
You also need "others read" permissions:
> ls -l test-cgi
-r-x-----x 1 root wheel 779 Dec 11 2004 test-cgi
> curl -s -w "%{http_code}n" -o /dev/null http://localhost:8080/cgi-bin/test-cgi
500
> chmod o+r test-cgi ; ls -l test-cgi
-r-x---r-x 1 root wheel 779 Dec 11 2004 test-cgi
> curl -s -w "%{http_code}n" -o /dev/null http://localhost:8080/cgi-bin/test-cgi
200
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f109866%2fconfiguring-apache-2-4-for-cgi-on-freebsd%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
The problem is shell. Apache 4.2's test CGI scripts are written for bash
, and FreeBSD comes with default shell csh
. The scripts are not compatible with csh
, so it fails, and Apache spits an error.
To fix this, (1) install bash
, and (2) add shebang to specify bash location.
Because FreeBSD userland is explicitly separated from base, installed bash will be placed in /usr/local/bin
rather than /bin
. So add a shebang like this.
#!/usr/local/bin
And then, the script will work well.
1
I'm not sure this is quite correct. It's been a long time since I've run Apache but I recall the same error the first time I tried it and switching shells, in this way, was not the solution. If you notice the error says, "Permission denied..." which is not an error from using the wrong shell and installing a package should have resolved that if the shell was the problem.
– Rob
Apr 15 '15 at 12:21
add a comment |
The problem is shell. Apache 4.2's test CGI scripts are written for bash
, and FreeBSD comes with default shell csh
. The scripts are not compatible with csh
, so it fails, and Apache spits an error.
To fix this, (1) install bash
, and (2) add shebang to specify bash location.
Because FreeBSD userland is explicitly separated from base, installed bash will be placed in /usr/local/bin
rather than /bin
. So add a shebang like this.
#!/usr/local/bin
And then, the script will work well.
1
I'm not sure this is quite correct. It's been a long time since I've run Apache but I recall the same error the first time I tried it and switching shells, in this way, was not the solution. If you notice the error says, "Permission denied..." which is not an error from using the wrong shell and installing a package should have resolved that if the shell was the problem.
– Rob
Apr 15 '15 at 12:21
add a comment |
The problem is shell. Apache 4.2's test CGI scripts are written for bash
, and FreeBSD comes with default shell csh
. The scripts are not compatible with csh
, so it fails, and Apache spits an error.
To fix this, (1) install bash
, and (2) add shebang to specify bash location.
Because FreeBSD userland is explicitly separated from base, installed bash will be placed in /usr/local/bin
rather than /bin
. So add a shebang like this.
#!/usr/local/bin
And then, the script will work well.
The problem is shell. Apache 4.2's test CGI scripts are written for bash
, and FreeBSD comes with default shell csh
. The scripts are not compatible with csh
, so it fails, and Apache spits an error.
To fix this, (1) install bash
, and (2) add shebang to specify bash location.
Because FreeBSD userland is explicitly separated from base, installed bash will be placed in /usr/local/bin
rather than /bin
. So add a shebang like this.
#!/usr/local/bin
And then, the script will work well.
answered Jan 18 '14 at 9:17
Eonil
1,52262128
1,52262128
1
I'm not sure this is quite correct. It's been a long time since I've run Apache but I recall the same error the first time I tried it and switching shells, in this way, was not the solution. If you notice the error says, "Permission denied..." which is not an error from using the wrong shell and installing a package should have resolved that if the shell was the problem.
– Rob
Apr 15 '15 at 12:21
add a comment |
1
I'm not sure this is quite correct. It's been a long time since I've run Apache but I recall the same error the first time I tried it and switching shells, in this way, was not the solution. If you notice the error says, "Permission denied..." which is not an error from using the wrong shell and installing a package should have resolved that if the shell was the problem.
– Rob
Apr 15 '15 at 12:21
1
1
I'm not sure this is quite correct. It's been a long time since I've run Apache but I recall the same error the first time I tried it and switching shells, in this way, was not the solution. If you notice the error says, "Permission denied..." which is not an error from using the wrong shell and installing a package should have resolved that if the shell was the problem.
– Rob
Apr 15 '15 at 12:21
I'm not sure this is quite correct. It's been a long time since I've run Apache but I recall the same error the first time I tried it and switching shells, in this way, was not the solution. If you notice the error says, "Permission denied..." which is not an error from using the wrong shell and installing a package should have resolved that if the shell was the problem.
– Rob
Apr 15 '15 at 12:21
add a comment |
You also need "others read" permissions:
> ls -l test-cgi
-r-x-----x 1 root wheel 779 Dec 11 2004 test-cgi
> curl -s -w "%{http_code}n" -o /dev/null http://localhost:8080/cgi-bin/test-cgi
500
> chmod o+r test-cgi ; ls -l test-cgi
-r-x---r-x 1 root wheel 779 Dec 11 2004 test-cgi
> curl -s -w "%{http_code}n" -o /dev/null http://localhost:8080/cgi-bin/test-cgi
200
add a comment |
You also need "others read" permissions:
> ls -l test-cgi
-r-x-----x 1 root wheel 779 Dec 11 2004 test-cgi
> curl -s -w "%{http_code}n" -o /dev/null http://localhost:8080/cgi-bin/test-cgi
500
> chmod o+r test-cgi ; ls -l test-cgi
-r-x---r-x 1 root wheel 779 Dec 11 2004 test-cgi
> curl -s -w "%{http_code}n" -o /dev/null http://localhost:8080/cgi-bin/test-cgi
200
add a comment |
You also need "others read" permissions:
> ls -l test-cgi
-r-x-----x 1 root wheel 779 Dec 11 2004 test-cgi
> curl -s -w "%{http_code}n" -o /dev/null http://localhost:8080/cgi-bin/test-cgi
500
> chmod o+r test-cgi ; ls -l test-cgi
-r-x---r-x 1 root wheel 779 Dec 11 2004 test-cgi
> curl -s -w "%{http_code}n" -o /dev/null http://localhost:8080/cgi-bin/test-cgi
200
You also need "others read" permissions:
> ls -l test-cgi
-r-x-----x 1 root wheel 779 Dec 11 2004 test-cgi
> curl -s -w "%{http_code}n" -o /dev/null http://localhost:8080/cgi-bin/test-cgi
500
> chmod o+r test-cgi ; ls -l test-cgi
-r-x---r-x 1 root wheel 779 Dec 11 2004 test-cgi
> curl -s -w "%{http_code}n" -o /dev/null http://localhost:8080/cgi-bin/test-cgi
200
answered Nov 24 '16 at 19:08
Fedor Dikarev
993310
993310
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f109866%2fconfiguring-apache-2-4-for-cgi-on-freebsd%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown