Premature End of Script Headers from git-http-backend - apache

I am attempting to install git and Apache on Windows. I have installed MSYSGit 1.7.3 on my Windows 2008 server (x64). I selected that the git commands should work from a Windows command prompt when I installed msysgit.
I have added these lines to my http.conf file:
SetEnv GIT_PROJECT_ROOT C:/Repositories
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias /git/ "C:/Progra~2/git/libexec/git-core/git-http-backend.exe/"
<Directory />
Options +ExecCGI
Allow from all
</Directory>
I created a repository (MKE_Playground.git). I added a file test.txt.
When I attempt to access the URL http://localhost/git/MKE_Playground.git I get this error in the Apache log:
[Tue Feb 01 15:56:09 2011] [notice] Child 1164: Child process is running
[Tue Feb 01 15:56:09 2011] [notice] Child 1164: Acquired the start mutex.
[Tue Feb 01 15:56:09 2011] [notice] Child 1164: Starting 64 worker threads.
[Tue Feb 01 15:56:09 2011] [notice] Child 1164: Starting thread to listen on port 80.
127.0.0.1 - - [01/Feb/2011:15:56:14 -0600] "GET /git/MKE_Playground.git HTTP/1.1" 500 539
[Tue Feb 01 15:56:14 2011] [error] [client 127.0.0.1] Premature end of script headers: git-http-backend.exe
I know that this means that the headers from the script were malformed. If I were writing the script I would check there, but I assume that the git backend typically provides correct headers. My take on this is that the git http backend failed for some reason. Where can I go to determine why it failed? Is there a Git log someplace?
Pat O

I dealt with a similar problem earlier.
Running "git-http-backend.exe" in a Cygwin shell revealed that the dll, "libiconv2.dll" could not be found. The file is located in the git/bin directory for my Git install (mostly defaults). I added the bin and libexec directories of the git install to my Path, and was able to clone the git repository locally through Apache.
Note: My Apache error logs looked like this - git-http-backend.exe was failing on the missing dll, but not reporting that in the httpd logs:
[Mon Feb 14 15:26:02 2011] [notice] Child 3308: Starting 64 worker threads.
[Mon Feb 14 15:26:02 2011] [notice] Child 3308: Starting thread to listen on port 80.
[Mon Feb 14 15:26:20 2011] [error] [client 127.0.0.1] Premature end of script headers: git-http-backend.exe
[Mon Feb 14 15:26:20 2011] [error] [client 127.0.0.1] Premature end of script headers: git-http-backend.exe

This worked for my 1.7.6.msysgit.0 setup:
In http://www.jeremyskinner.co.uk/2010/07/31/hosting-a-git-server-under-apache-on-windows/, Jeremy Skinner suggests that it must be possible to run Git\libexec\git-http-backend.exe in a Windows cmd shell. When this fails, copy Git\bin\libiconv-2.dll and Git\bin\libiconv2.dll to Git\libexec\git-core and try again. If you can call git-http-backend.exe and it gives you a "500 Internal Server Error", try your clone or fetch again.

I was fighting the same issue. In my case it was a user permission problem. You can check the "log on" information for the Apache Windows Service and test with your domain user for instance (Control Panel->Administrative Tools->Services->Apache->Log On Tab).
After a reboot, browsing to your http://localhost/git/MKE_Playground.git should then give you a Request not supported error in your error.log. That's fine.
git clone http://localhost/git/MKE_Playground.git should work then.

I have abandonded the idea of running Git on Windows. As such this is no longer an issue for me.
Thanks for your help.

Related

MAMP: Apache Server is shut down automatically in Windows 10

OS: Windows 10
MAMP: 4.1.1
After installation, every time I run the program, Apache light goes green for a second and then turns off automatically. MySQL runs fine though.
The log file located at C:\MAMP\logs\apache_error.log contains these lines.
[Fri Jan 17 18:03:42 2020] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Fri Jan 17 18:03:43 2020] [warn] pid file C:/MAMP/bin/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Fri Jan 17 18:03:43 2020] [notice] Digest: generating secret for digest authentication ...
[Fri Jan 17 18:03:43 2020] [notice] Digest: done
I find a lot of people online encountered the same situation as mine. But I cannot find out the solution. So I come here to find the potential solution.
P.S. I don't have the common Port 80 confliction problem. So I'm sure my problem is not related to it.
Navigate to C:\MAMP\conf\apache\extra.
Edit the httpd-ssl.conf and comment the following line:
...
SSLSessionCache shmcb:/some/example/path/ssl_scache(512000)
...
To:
...
# SSLSessionCache shmcb:/some/example/path/ssl_scache(512000)
...
Also, check out https://cwiki.apache.org/confluence/display/HTTPD/SSLSessionCache for more info. Hope this helps.

Anyone succeeded to Install Laravel on Apache2 with fcgi?

I have successfully installed Laravel on Apache2 with php as a module. The instructions are simple. However, when I try with fcgi it does not work. So it has to do with the server configuration. After I visited http://<mylaraveldomain> (domain not public), I looked at /var/log/apache2/error.log and got this error message
[Thu Mar 26 22:52:34.012794 2015] [fcgid:warn] [pid 30834] (104)Connection reset by peer: [client 65.92.253.153:7785] mod_fcgid: error reading data from FastCGI server
[Thu Mar 26 22:52:34.012862 2015] [core:error] [pid 30834] [client 65.92.253.153:7785] End of script output before headers: php-fcgi-wrapper
[Thu Mar 26 22:52:39.826939 2015] [fcgid:error] [pid 30830] mod_fcgid: process /var/www/default/cgi-bin/php5-default/php-fcgi-wrapper(31115) exit(communication error), get unexpected signal 11
I also looked at all other log files in /var/log recently modified after visiting the URL, but no additional useful info was found. Should I look elsewhere? It is not that fcgi is not working, because if I put a file test.php in laravel public folder I can read it fine at the URL http://<mylaraveldomain>/test.php. Is there some special configuration settings to make laravel works with fcgi ? It is possible that it is specific to my installation of fcgi. So, I would like to know if others have succeeded to install laravel with fcgi on apache2. I am on Ubuntu and I made a recent apt-get upgrade.
I checked syslog and there was additional info. I could see a segment fault. I guessed it could be cache management issue. I commented out the line zend_extension=opcache.so in the file /etc/php5/apache2/conf.d/05-opcache.ini and it worked. Of course, this is only a work around.

Mercurial does not startup upon system launch [FreeBSD 9.0 Apache22]

Struggling to find a root of issue with Apache22 and mercurial. Everything seems to work right — made repository, folder with properly configured hgweb.cgi, set permissions etc.
Here comes the main problem. Everything works only if I (re)start Apache manually, using /usr/local/etc/rc.d/apache22 restart otherwise, using service apache22 restart or while whole system is booting, I'm getting up and running Apache with website accessible. But once trying to access web interface it gives me "Internal Server Error" in browser and next messages in http-error.log
[Fri Apr 20 17:49:40 2012] [error] [client 10.20.30.34] env:
[Fri Apr 20 17:49:40 2012] [error] [client 10.20.30.34] python
[Fri Apr 20 17:49:40 2012] [error] [client 10.20.30.34] :
[Fri Apr 20 17:49:40 2012] [error] [client 10.20.30.34] No such file or directory
[Fri Apr 20 17:49:40 2012] [error] [client 10.20.30.34] Premature end of script headers: hgweb.cgi
My guess is that it could be an issue with environment variables but what a heck is a difference between service run and direct call of script from /usr/local/rc.d/ ? Am I missing something?
Check PATH, it look likes python is not in your path. Maybe add /usr/local/bin to the path of the www user
Solution is really about making user running httpd (www in my case) to have $PATH adjusted. But it might not be obvious for everyone so here is what I did:
created /usr/local/etc/apache22/envvars.d/path.env with content
#!/bin/bash
export PATH=$PATH:/usr/local/bin:/usr/local/sbin
This require Apache to have env_module loaded but this looks like a standard module to be loaded in default configuration.

Getting output from the subprocess.Popen command into a webpage? (maybe an apache issue)

Here is my program
import subprocess
print "Content-type:text/html\r\n\r\n"
print "File starting to execute"
print "<br>"
proc = subprocess.Popen(["sudo", "python", "test3.py"], stdout=subprocess.PIPE)
output = proc.stdout.read()
print "output is %s" %output
print "<br>"
print "File Executed Awesomely"
So when I run it from the command line it works great, like follows->
[root#localhost html]# python test2.py
Content-type:text/html
File starting to execute
<br>
output is .
Sent 1 packets.
<br>
File Executed Awesomely
[root#localhost html]#
that is perfect the ". Sent 1 packets." is what I want. But when I run it from the webpage, the webpage just has
File starting to execute
output is
File Executed Awesomely
so I originally thought this was because I was doing something wrong grabbing the output but I listened on the port with wireshark (my other program it calls send a packet) and it looks like no packets shows up via the webpage call, but it does when I call it on the command line (the same way). Looking at my apache error_log->
[Wed Jan 18 18:15:11 2012] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Jan 18 18:15:11 2012] [notice] Digest: generating secret for digest authentication ...
[Wed Jan 18 18:15:11 2012] [notice] Digest: done
[Wed Jan 18 18:15:11 2012] [warn] ./mod_dnssd.c: No services found to register
[Wed Jan 18 18:15:11 2012] [notice] Apache/2.2.17 (Unix) DAV/2 configured -- resuming normal operations
any suggestions on how I can fix it so my apache cgi-bin script runs the same way as the command line?
EDIT: looking at the log after a few calls it does this repeatedly
[Wed Jan 18 18:22:37 2012] [error] [client 10.117.153.89] :
[Wed Jan 18 18:22:37 2012] [error] [client 10.117.153.89] sorry, you must have a tty to run sudo
The message sorry, you must have a tty to run sudo is the key. First of all, letting your apache run sudo is dangerous to say the least, but if you really really want to do it... there's a way, edit /etc/sudoers (visudo) and locate the Defaults requiretty part (man sudoers).
NB: Never let apache run anything using sudo, specify exactly what it needs to do and nothing more!
BTW: It may still not work if you have SELinux enabled or other LSM module.

My repository access died when I used CVS2SVN?

I had a problem running CVS2SVN on my server. I have run it successfully before but I got a sort error in pass 5 so this time I added a sort option that pointed to a sort program on my system. (sort="C:/cygwin/bin/sort.exe"). It worked great and CVS2SVN appeared to complete successfully. So I went to my desktop to check out the files (svn co file:///C:/repo_name) and I got this error:
svn: unable to open an ra_local session to url. svn: Unable to open
repository 'file:///C:/repo_name'
When I tried to access my other repositories I got the same message. I checked the Apache log file and I found these messages:
The Apache2.2 service is restarting. Starting the Apache2.2 service.
The Apache2.2 service is running. Init: Session Cache is not
configured [hint: SSLSessionCache]
[Wed Oct 26 15:37:33 2011] [warn] pid file C:/Program Files
(x86)/Apache Software Foundation/Apache2.2/logs/httpd.pid
overwritten -- Unclean shutdown of previous Apache run?
[Wed Oct 26 15:37:40 2011] [error] Internal error: pcfg_openfile()
called with NULL filename
[Wed Oct 26 15:37:40 2011] [error] [client 147.16.148.223] (9)Bad file
descriptor: Could not open password file: (null)
[Wed Oct 26 15:38:37 2011] [error] [client 147.17.209.173]
(20014)Internal error: Can't open file 'c:\projects\svn\format':
The system cannot find the file specified.
[Wed Oct 26 15:38:37 2011] [error] [client 147.17.209.173] Could not
fetch resource information. [500, #0]
[Wed Oct 26 15:38:37 2011] [error] [client 147.17.209.173] Could not
open the requested SVN filesystem [500, #720002]
I have found that if I log on to the server I can check out the files but I when I try to check them back in I get
Error: Commit failed (details follow): Error: Could not open the
requested SVN filesystem
Prior to this, I had been trying to get SSL certificates working on my server and had been changing options in my Apache httpd file. It is currently set to the bare minimum with only one Virtual host *:80 and the following:
<Location /svn >
DAV svn
SVNListParentPath on
SVNPath "c:\projects\svn"
AuthName "Subversion repository (Basic)"
AuthType Basic
</Location>
<Location /webSVN/>
Options FollowSymLinks
AuthType Basic
AuthName "Subversion Repository (web)"
</Location>
I commented out the Include ssl.conf line that brings in all the SSL settings.
Please help! I need to be able to access my repositories from my desktop!