digioleg54 has asked for the wisdom of the Perl Monks concerning the following question:

I have a problem with Apache on Linux. When I run the simple program, the error log sais:

suexec failure: could not open log file fopen: Permission denied failed to open log file /var/log/www/cgi_log: Permission denied (euid= +218637) failed whilst writing: Exec format error: exec failed Premature end of script headers

Could you help me to solve the problem?

Replies are listed 'Best First'.
Re: Problem with apache server
by derby (Abbot) on May 12, 2017 at 10:22 UTC

    Geez ... the number of non-answers here is not helpful. This could be a problem with your perl script -- does it try to write to /var/log/www/cgi_log -- or with your apache config. The main problem is either your cgi script or the apache server itself is trying to write to /var/log/www/cgi_log but the process does not have permission to write there. Check:

    • does your cgi-script write to /var/log/www/cgi_log .. if so, you cannot write there. Work with your apache admin to figure out where you can write (hint -- just write to STDERR and a properly config-ed apache will write to the proper log)
    • does your apache conf use /var/log/www/cgi_log as one of its' logs (look for CustomLog, ErrorLog, RewriteLog, etc) .. if so, then check what user your apache process runs as and ensure it has perms to write to /var/log/www/cgi_log or change your log to some place the running apache user can write to
    • and if /var/log/www/cgi_log is the *place* ... check its' permission and change them so the apache process user can write to it (I've had situations in the past where some off-line process would erroneously change permission on files it shouldn't have).

Re: Problem with apache server
by Anonymous Monk on May 11, 2017 at 19:36 UTC


    Like CGI Help Guide says  use CGI::Carp qw/ fatalsToBrowser /;

    This avoids both the problems you reported, permission denied to open log file (an "admin" problem, he who configure apache and grant permissions), and premature end of script headers (your program)

    Every perl/CGI problem can be solved if you work through CGI Help Guide

    When you find a problem on the list, use a solution from the list,

    If you get stuck or find a problem not on the list, post the error message and problem description here

Re: Problem with apache server (OT?)
by LanX (Saint) on May 11, 2017 at 14:43 UTC
      We have Perl CGI programs on apache.

        That's like asking us for advice about a broken arm because you usually use your arms to type Perl code.

        Well, okay, maybe not quite that badů