Author |
|
DnvrSysEngr
Joined: 15 Apr 2012 Posts: 226 Location: Denver, CO USA
|
|
Back to top |
|
apache-lounge-chair
Joined: 24 Apr 2016 Posts: 18 Location: usa, atlanta
|
Posted: Sun 26 Jun '16 19:52 Post subject: Apache2.4 cgi-bin issues |
|
|
I went to the link ypu showed for adding perl cgi support and from what I saw my httpd.conf file is configured correctly. I still amnot able to get apache to recognize ".pl" or ".cgi" files. I still get a "404 not found" error message which is :
Not Found
The requested URL /cgi-bin/qwlc.cgi was not found on this server.
Here is an extract from my httpd.conf file
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
# client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.
#
ScriptAlias /cgi-bin/ "c:/Apache24/cgi-bin/"
</IfModule>
<IfModule cgid_module>
#
# ScriptSock: On threaded servers, designate the path to the UNIX
# socket used to communicate with the CGI daemon of mod_cgid.
#
#Scriptsock cgisock
</IfModule>
#
# "c:/Apache24/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "c:/Apache24/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory> |
|
Back to top |
|
DnvrSysEngr
Joined: 15 Apr 2012 Posts: 226 Location: Denver, CO USA
|
Posted: Sun 26 Jun '16 23:22 Post subject: |
|
|
In Section 2 of the "how to" document, did you follow the steps and make the additions to your HTTPD.CONF?
Running CGI scripts anywhere in your domain
If you don't want to be restricted to running CGI scripts within the ScriptAlias directory in your domain, and want CGI scripts to run anywhere in your domain, add the following line to your "httpd.conf" file.
AddHandler cgi-script .cgi
You can add it yourself manually, but since the default httpd.conf file that is supplied by Apache already comes with that line commented out, the simplest thing would be to search for that string in your existing file, and remove the preceding comment character, that is, remove the "#".
If you want the .pl extension recognised as a CGI script as well, simply append the extension to the list, as follows:
AddHandler cgi-script .cgi .pl
Next, search for the line that says "<Directory /> in the file. It should look something like this:
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
Add "+ExecCGI" to the options list. The line now looks like this:
Options FollowSymLinks +ExecCGI
After making the necessary additions to your HTTPD.CONF file, did you restart the Apache server? |
|
Back to top |
|
DnvrSysEngr
Joined: 15 Apr 2012 Posts: 226 Location: Denver, CO USA
|
Posted: Sun 26 Jun '16 23:54 Post subject: |
|
|
Just a quick recap:
Search the httpd.conf file for the line
Options Indexes FollowSymLinks
Add ExecCGI to this line. The line should now look like the following:
Options Indexes FollowSymLinks ExecCGI
Next, search for the following:
#AddHandler cgi-script .cgi
Uncomment this line by removing the # in front of the line, and add a .pl to the end of the line. The new line should look like this:
AddHandler cgi-script .cgi .pl
Save the changes you made to httpd.conf and restart the Apache server. |
|
Back to top |
|
apache-lounge-chair
Joined: 24 Apr 2016 Posts: 18 Location: usa, atlanta
|
Posted: Mon 27 Jun '16 0:09 Post subject: Apache2.4 CGI issues |
|
|
In your recap you refer to "Options Indexes" which is not the same same section you referred to in the 1st part of your message. I modified my file according to the 1st part of your message and restarted the Apache2.4 server with the command "httpd.exe -k restart"
This did not resolve the problem. |
|
Back to top |
|
DnvrSysEngr
Joined: 15 Apr 2012 Posts: 226 Location: Denver, CO USA
|
Posted: Mon 27 Jun '16 0:21 Post subject: |
|
|
added the indexes on accident from my previous/old conf file. Sorry for the typo.
What error message/messages are you still receiving? |
|
Back to top |
|
apache-lounge-chair
Joined: 24 Apr 2016 Posts: 18 Location: usa, atlanta
|
Posted: Mon 27 Jun '16 0:56 Post subject: Apache2.4 CGI issues on windows 10 |
|
|
when i try to visit http://localhost:8888/cgi-bin/printenv.pl
I see a "404 not found" error message like the following
Not Found
The requested URL /cgi-bin/printenv.pl was not found on this server.
when I check the error log file there is no indication of any problem. the last line in the error log states "Starting 64 worker threads" |
|
Back to top |
|
DnvrSysEngr
Joined: 15 Apr 2012 Posts: 226 Location: Denver, CO USA
|
Posted: Mon 27 Jun '16 4:55 Post subject: |
|
|
Make sure that the first line of your .CGI file looks similar to this:
#!"c:\perl64\bin\perl.exe"
Or where ever the Perl executable is located. |
|
Back to top |
|
DnvrSysEngr
Joined: 15 Apr 2012 Posts: 226 Location: Denver, CO USA
|
|
Back to top |
|
apache-lounge-chair
Joined: 24 Apr 2016 Posts: 18 Location: usa, atlanta
|
Posted: Mon 27 Jun '16 12:43 Post subject: Apache2.4 CGI issues |
|
|
The 1st line of my perl CGI script does properly identify the path of the perl executable file as indicated in your example, but my attempt to visit the url still results in a "404 not found" error from the browser. |
|
Back to top |
|
DnvrSysEngr
Joined: 15 Apr 2012 Posts: 226 Location: Denver, CO USA
|
Posted: Mon 27 Jun '16 16:16 Post subject: |
|
|
I will be turning up an Apache 2.4.20 64-bit server from scratch on my Windows10 laptop this morning and will try to replicate your issue/s. Keep you informed.
-S |
|
Back to top |
|
DnvrSysEngr
Joined: 15 Apr 2012 Posts: 226 Location: Denver, CO USA
|
Posted: Mon 27 Jun '16 18:59 Post subject: |
|
|
There is nothing proprietary / confidential on my test installation of Apache 2.4.20 server, so I will post the whole HTTPD.CONF file on here for you to sift through and compare to your HTTPD.CONF file.
I will post a test cgi file for you to use in another post.
Admin note:
moved httpd.conf conf to http://apaste.info/EXP
see forum rules and top of the post screen. |
|
Back to top |
|
DnvrSysEngr
Joined: 15 Apr 2012 Posts: 226 Location: Denver, CO USA
|
Posted: Mon 27 Jun '16 19:10 Post subject: |
|
|
Here is a CGI file for you test with.
I have ActiveState PERL (64-bit) installed in the default location (and noted in the test.cgi file) on my 64-bit Windows 10 laptop. With PERL installed, the TEST.CGI and PRINTENV.PL files in the /CGI-BIN/ directory work as advertised when opening a browser on my laptop and going to:
http://localhost:88/cgi-bin/printenv.pl
and
http://localhost:88/cgi-bin/test.cgi
Note: I am using port 88 as I have NGINX running on port 80. If I am correct, you are running Apache on port 8888 on your machine.
Copy and Paste test.cgi below
=============================
#!"C:\Perl64\bin\perl.exe"
# test.cgi by Anonymous [http://somecompany.com/]
# Copyright 2016 Some Company
# Free Software: Use and distribution under the same terms as perl.
use strict;
use warnings;
use CGI;
print foreach (
"Content-Type: text/plain\n\n",
"CGI test file - version 1.0\n",
"Copyright 2016, Some Company\n\n",
"Versions:\n=================\n",
"perl: $]\n",
"CGI: $CGI::VERSION\n"
);
my $q = CGI::Vars();
print "\nCGI Values:\n=================\n";
foreach my $k ( sort keys %$q ) {
print "$k [$q->{$k}]\n";
}
print "\nEnvironment Variables:\n=================\n";
foreach my $k ( sort keys %ENV ) {
print "$k [$ENV{$k}]\n";
}
|
|
Back to top |
|
apache-lounge-chair
Joined: 24 Apr 2016 Posts: 18 Location: usa, atlanta
|
Posted: Wed 29 Jun '16 2:20 Post subject: Apache2.4 is working now |
|
|
Much thanks for all your efforts. with a slight tweak to the HTTPD.CONF file you posted I now have Apache2.4 up and running my CGI scripts from port 88 on my windows 10 64 bit laptop. |
|
Back to top |
|
DnvrSysEngr
Joined: 15 Apr 2012 Posts: 226 Location: Denver, CO USA
|
Posted: Wed 29 Jun '16 5:53 Post subject: |
|
|
You are very welcome. I figured with having it running on one Server already and then turning up a new Server from scratch and getting it to work right away, posting a working config for you to compare with would get your issue straightened out for you. I was not willing to give up on this issue for you.
-S |
|
Back to top |
|