Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2008

    Question Script calls shmget, dies under Apache only

    When my Apache installation tries to serve an executable file that calls shmget it gives an internal server error. The same executable works fine on Cygwin command line.

    I have installed and setup Apache under Cygwin under Windows XP. I am writing web pages for an embedded Linux system and using the setup above as a development/test platform. Each web page is a C program, compiled and linked to produce an executable using Cygwin and Gnu C. For example, the home page would be index.exe. When this program is executed on the Cygwin command line, it sends HTML to stdout that defines the web page. The HTML is valid per HTML 4.01 Transitional.

    The problem has been narrowed to a call to shmget to access shared memory segments created by another thread. Any CGI program using this shared memory method will run correctly if executed on the Cygwin command line. However, it always fails when Apache runs it. A very simple executable that uses only printf to generate HTML, and does not call shmget, is served correctly by Apache.

    I tried changing User and Group to match what I see in Cygwin and to match Windows names. But that had no affect. So the question becomes, what is it about the Apache process that causes shmget to fail? The error reported by Apache is "Premature end of script headers" which now makes sense because I understand the header line "Content-type: text/html\n\n" is not being sent because index.exe dies in shmget before it generates output.

    Any tips on how to debug this? Thanks.

  2. #2

    Script calls shmget, dies under Apache only

    I'm experiencing same problem with a c-written cgi that calls shmget method.

    on a cygwin platform running with Windows XP, this cgi works OK when run from a command line, but failed when run from thttpd.

    Same problem occurs on a semget call.

    I tried to recomplie thttpd after adding /lib/ in config.h at CGI_LD_LIBRARY_PATH, but it did not change anything.

    Anyone has tips about solving this problem ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts