To determine if your script is running and what user and group it runs as, you might have it write to STDERR and add a long sleep. Output to STDERR should appear in the web server error log. While it is sleeping you can inspect the process with ps to determine security context. If nothing appears in the error log and you can't see the process with ps, then the script is probably not running at all, in which case suexec and selinux appear to be your prime suspects.

If suexec is running, the web server error log should have something like the following each time the server starts:

[notice] suEXEC mechanism enabled (wrapper: /path/to/suexec)

If it is running, there should be a log file: suexec_log in the web server log directory, by default. This should indicate the problem if suexec is refusing to run your script. Note that with suexec the user and group your script runs as may be specified by an SuexecUserGroup directive in the apache configuration.

The sestatus command will tell you whether selinux is running and enforcing, with output similar to the following:

[root@localhost ~]# sestatus SELinux status: enabled SELinuxfs mount: /selinux Current mode: enforcing Mode from config file: enforcing Policy version: 21 Policy from config file: targeted

On my system, it says:

[root@localhost ~]# sestatus SELinux status: disabled

I have selinux disabled, but I understand that as of RHEL/CentOS 5, messages are written to the audit logs rather than /var/log/messages and the setroubleshoot command is supposed to be make reviewing the logs easy. http://www.linuxtopia.org/online_books/centos5/centos5_administration_guide/centos5_rhlcommon-chapter-0017.html might be helpful.


In reply to Re: Premature end of script headers more annoying than usual . . . by ig
in thread Premature end of script headers more annoying than usual . . . by hesco

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.