Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running LAMP on Arch and now want the gitweb going on apache. Followed the instructions as in https://wiki.archlinux.org/index.php/Gitweb but on the gitweb directory (here localhost/~myuser/gitweb) I get:

Server error!

The server encountered an internal error and was unable to complete your request.

Error message: 
Premature end of script headers: gitweb.cgi

If you think this is a server error, please contact the webmaster.

Error 500

Fri Jun 8 15:14:11 2012
Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/1.0.1c DAV/2 PHP/5.4.3
share|improve this question
Without additional information from e.g. the apache error log we won't be able to help. What happens if you execute the script yourself? – Ulrich Dangel Jun 8 '12 at 14:25
Ending up in suexec.log I see this: [2012-06-08 13:29:51]: uid: (1000/myuser) gid: (1000/myuser) cmd: gitweb.cgi [2012-06-08 13:29:51]: command not in docroot (/usr/share/gitweb/gitweb.cgi) – Haix64 Jun 8 '12 at 14:34
This is a security feature by suexec you are only allowed to execute a command within your document root, see httpd.apache.org/docs/2.2/suexec.html#model point 13 – Ulrich Dangel Jun 8 '12 at 14:39
Thanks. I'm reading the page. But is there some major probability you have a solution for so I could test NOW? – Haix64 Jun 8 '12 at 14:43
Move gitweb into your docroot, e.g. your public_html folder. You could either try to setup a symlink or hard link if you don't want to copy the file into your folder but i'd assume only a hardlink would work. – Ulrich Dangel Jun 8 '12 at 14:49

I had the same error and resolved it by installing the perl-cgi package

$ sudo pacman -S perl-cgi

N.b, I debugged this by running the failing script directly, i.e,

$ cd /usr/share/gitweb/ 
$ ./gitweb.cgi
Can't locate CGI.pm in @INC (you may need to install the CGI module)(@INC contains: /usr/lib/perl5/site_perl /usr/share/perl5/site_perl /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/core_perl /usr/share/perl5/core_perl .) at ./gitweb.cgi line 13.
BEGIN failed--compilation aborted at ./gitweb.cgi line 13.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.