cgi-bin files do not execute

Alles, was den Apache betrifft, kann hier besprochen werden.

cgi-bin files do not execute

Postby yoshiki » 04. January 2020 03:42

I have trouble executing files in the cgi directory. I installed apache2, accompanied with mailman and postfix, to control mailman using apache2. Though I put the following lines in /etc/apache2/apache2.conf ,

ScriptAlias /mailman/ "/usr/local/mailman/cgi-bin"
<Directory "/usr/local/mailman/cgi-bin/">
AllowOverride None
Require all granted
</Directory>

and restarted apache2, the files in the /usr/local/mailman/cgi-bin are still treated as regular files, when I visit this URL by a browser;
the browser just prints the file's contents on the browser's pain, but not executes them. As an information, I use apache-2.4.29, ubuntu-18.04, mailman-2.1.29. I'll appreciate your help.
- Yoshiki
yoshiki
 
Posts: 2
Joined: 04. January 2020 03:13
XAMPP version: 7.4.1
Operating System: ubuntu-18.04

Re: cgi-bin files do not execute

Postby Nobbie » 04. January 2020 11:23

This is Xampp Apache Forum, sorry, we dont know all Linux distributions.

Only a few ideas (i dont know nothing about your Apache configuration):

1) Is the file extension properly declared as CGI Script?
2) Is there a valid shebang line in the script? Its the first line and it should look like:

Code: Select all
#!/usr/bin/perl


or similar.

3) Which URL do you enter into your browser?
Last edited by Nobbie on 04. January 2020 11:28, edited 3 times in total.
Nobbie
 
Posts: 13176
Joined: 09. March 2008 13:04

Re: cgi-bin files do not execute

Postby nemesis » 04. January 2020 11:25

Ubuntu 18.04 | SMP P3 1.4 GHz | 6 GByte RegECC | 74 GByte Seagate 15k5 system | 3Ware 9550SXU-4LP with 4x 500 GByte Seagate ES2 Raid 10 data | StoreCase DE400 | PX-230A | Intel Pro/1000MT Dual PCI-X
User avatar
nemesis
AF Moderator
 
Posts: 1044
Joined: 29. December 2002 13:14
Location: Ingolstadt
XAMPP version: depends
Operating System: Linux, BSD, Win, iOS, Android

Re: cgi-bin files do not execute

Postby yoshiki » 05. January 2020 00:39

Thank you for your help. There were two problems,
(1) file's group permission for execution were not set. So I did
% sudo chmod g+x *
in the cg-bin directory.
(2) apache2 was not loaded with the cgi function. So I did
% cd /etc/apache2/mods-enabled
% sudo ln -s ../mods-avaialble/cgi.load
Then the problem was solved. Now apache2 can execute cgi-bin files.
Thank you, Yoshiki
yoshiki
 
Posts: 2
Joined: 04. January 2020 03:13
XAMPP version: 7.4.1
Operating System: ubuntu-18.04

Re: cgi-bin files do not execute

Postby Nobbie » 05. January 2020 13:08

yoshiki wrote:(1) file's group permission for execution were not set. So I did
% sudo chmod g+x *
in the cg-bin directory.


Actually that should not be necessary. The file is not executed by the shell (which requires execution permission). Perhaps you have activated the so called "Xbit Hack"?!
Nobbie
 
Posts: 13176
Joined: 09. March 2008 13:04


Return to Apache

Who is online

Users browsing this forum: No registered users and 104 guests