cgi scripts fail to run from userdir with "End of script output before headers" errors

Lonni J Friedman netllama at gmail.com
Tue Oct 7 16:17:52 PDT 2014


I definitely have suexec enabled:
[Mon Oct 06 16:09:31.518777 2014] [suexec:notice] [pid 20128] AH01232:
suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)

Renaming the suexec binary, and retrying didn't really help:
[Tue Oct 07 16:17:15.854011 2014] [cgi:error] [pid 26631] [client
127.0.0.1:55657] AH01215: (2)No such file or directory: exec of
'/usr/sbin/suexec' failed
[Tue Oct 07 16:17:15.854671 2014] [cgi:error] [pid 26631] [client
127.0.0.1:55657] End of script output before headers: foo.py

I added a handler to the "<Directory /home/*/public_html/cgi-bin>"
section of my apache config, but that didn't have any impact on the
problem.

Any other suggestions?


On Tue, Oct 7, 2014 at 6:28 AM, David A. Bandel <david.bandel at gmail.com> wrote:
> Lonnie,
>
> With or without suexec, you will need a handler line:
> AddHandler cgi-script .cgi .py
> (make sure the above line has the pertinent extension, like .py and your
> python script ends in .py)
>
> If using suexec, you should see a line in your error_log:
> suEXEC mechanism enabled
>
> Your script must be runable by suEXEC user.  You  might find it easier to
> disable suexec (unless you need it).  Just rename the suexec script and
> restart apache and test.  If you the script works but you need suexec
> (because you're going to have lots of users that need to run CGI scripts),
> then you'll need to troubleshoot the suexec mess.
>
> David-
>
> On Mon, Oct 6, 2014 at 8:55 PM, Lonni J Friedman <netllama at gmail.com> wrote:
>>
>> Hi David,
>> I was actually leaning towards some kind of apache configuration
>> issue, but clearly i'm not the expert here, or I would have figured it
>> out myself :)
>>
>> To answer your questions:
>> Its a python script that I'm trying to run.
>> $HOME is on the same partition as / (which is the same partition as
>> the apache $DOCROOT).  Its all on a development system, not anything
>> resembling production.
>> The user's UID is greater than 1000.
>> I am using suexec.
>>
>> I'd be happy to answer any other questions.
>>
>> thanks
>>
>>
>> On Mon, Oct 6, 2014 at 6:45 PM, David A. Bandel <david.bandel at gmail.com>
>> wrote:
>> > Lonnie,
>> >
>> > This is one of the most annoying, frustrating errors.  All it says is
>> > that
>> > the script didn't work.  This may be permissions.  It may be your $HOME
>> > mount is non-executable.  Difficult to say.  You didn't say what kind of
>> > script it was (Perl, PHP, shell).  Is the UID of the user greater than
>> > 1000?
>> > Are you using suexec?
>> >
>> > I hate this error.  Will be either one of the permissions issues above
>> > or
>> > some Apache configuration issue (I'm betting on permissions).
>> >
>> > David-
>> >
>> > On Mon, Oct 6, 2014 at 5:57 PM, Lonni J Friedman <netllama at gmail.com>
>> > wrote:
>> >>
>> >> Howdy folks,
>> >> Any cgi/apach experts still around?  I'm trying to get cgi scripts
>> >> working from $USERDIR on a new Fedora system, and they all fail with
>> >> internal server errors.  In the apache error log, I see:
>> >> [cgi:error] End of script output before headers
>> >>
>> >> If I copy the script over to the server $DOCROOT/cgi-bin then it runs
>> >> just fine.  So this proves the script itself isn't the problem.
>> >> Additionally, non-cgi scripts are served just fine from $USERDIR.
>> >> Both the cgi-bin directory and the script itself are executable for
>> >> all users (755).  This is what I've got set in the apache config for
>> >> the USERDIR directory structure:
>> >>
>> >> <Directory "/home/*/public_html">
>> >>     AllowOverride FileInfo AuthConfig Limit Indexes
>> >>     Options MultiViews Indexes SymLinksIfOwnerMatch ExecCGI
>> >>     Require method GET POST OPTIONS
>> >> </Directory>
>> >>
>> >> <Directory /home/*/public_html/cgi-bin>
>> >>         AllowOverride Indexes AuthConfig
>> >>         Options ExecCGI
>> >>         SetHandler cgi-script
>> >> </Directory>
>> >>
>> >>
>> >> Anyone know what I'm missing?
>> >>
>> >> thanks
>>
>>
>> --
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> L. Friedman                                    netllama at gmail.com
>> LlamaLand                       http://netllama.linux-sxs.org
>> _______________________________________________
>> Linux-users mailing list
>> Linux-users at linux-sxs.org
>> http://mailman.celestial.com/mailman/listinfo/linux-users
>
>
>
>
> --
> Two things are infinite: the universe and human stupidity; and I'm not sure
> about the the universe. -- Albert Einstein
> Visit my web page at: http://david.bandel.us/
>
> _______________________________________________
> Linux-users mailing list
> Linux-users at linux-sxs.org
> http://mailman.celestial.com/mailman/listinfo/linux-users
>



-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
L. Friedman                                    netllama at gmail.com
LlamaLand                       http://netllama.linux-sxs.org


More information about the Linux-users mailing list