Results 1 to 2 of 2

Thread: .cgi 500 Internal Server Error Help

  1. #1
    Join Date
    Oct 2012
    Beans
    2

    .cgi 500 Internal Server Error Help

    Hello,
    I am not able to execute any of the .cgi files in the cgi-bin folder. I can execute .pl files in the “cgi-bin” folder but not .cgi files, not even a super simple .cgi file.

    Apache2 log error message:
    (13)Permission denied: exec of '/usr/lib/cgi-bin/test.cgi' failed Premature end of script headers: test.cgi

    I read through this tutorial: http://httpd.apache.org/docs/2.2/how...html#errorlogs

    Information:
    Windows Azure VM with Root Access
    Ubuntu Server 12.04 with desktop installed
    Perl is installed here: /usr/bin/perl
    Apache2 is installed
    PHP5 is installed
    There is no suexec in the /usr/lib/apache2 folder which is where this command says that apache looks for the file:
    Code:
    apachectl -V
    Permissions on /usr/lib/cgi-bin are 755

    Apache VirtualHost file:
    Code:
    	ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    	<Directory "/usr/lib/cgi-bin">
    		AllowOverride None
    		Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    		SetHandler cgi-script
    		Order allow,deny
    		Allow from all
    	</Directory>
    Portion of apache2.conf
    Code:
    apache2.conf
      AddHandler cgi-script .cgi .pl
    <Files ~ "\.pl$">
        Options +ExecCGI
    </Files>
    <Files ~ "\.cgi$">
       Options +ExecCGI
    </Files>
    
      <Directory /usr/lib/*/cgi-bin>
         Options +ExecCGI
         SetHandler cgi-script
      </Directory>
    Simple .cgi test file that does not work. test.cgi
    Code:
    #!/usr/bin/perl
    print "Content-type: text/html\n\n";
    print "<html><body><h1>Hello World</h1></body></html>\n";
    I have even tried Ubuntu with XAMPP and the .cgi scripts still will not work.

    Please let me know how to fix this.
    Thanks.

  2. #2
    Join Date
    Oct 2012
    Beans
    2

    Solved: Perl refuses to work in Ubuntu server (lamp-server)

    I found the answer here:
    http://www.linuxforums.org/forum/ser...mp-server.html

    Here is a portion of the working Virtual Host file:
    Code:
    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
            <Directory "/usr/lib/cgi-bin">
    		AllowOverride None
    		Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    		Order allow,deny
    		Allow from all
    		AddHandler cgi-script cgi pl
    	</Directory>
    
    # enable mod_perl
    <Files ~ "\.(pl|cgi)$">
           SetHandler perl-script
           PerlResponseHandler ModPerl::Registry
           Options +ExecCGI
           PerlSendHeader On
    </Files>

Bookmarks

Posting Permissions

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