MAMP: Apache Server is shut down automatically in Windows 10 - apache

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.

Related

Xvarnish (cachewall) with mod_pagespeed

There is an issue where I have a cpanel server with cachewall (Xvarnish used to be called) and mod_pagspeed installed.
Cachewall/Xvarnish has https support enabled.
The issue is that even though the header of the website is showing that both Cachewall and modpagespeed is running, I'm getting flooded with this in my apache error log:
[Mon Jul 03 20:45:49.060050 2017] [pagespeed:error] [pid 31223:tid 112490802050816] [mod_pagespeed 1.11.33.4-0 #31223] Serf status 120171(APR does not understand this error code) polling for 1 threaded fetches for 0.05 seconds
[Mon Jul 03 20:45:49.060071 2017] [pagespeed:error] [pid 31223:tid 112490802050816] [mod_pagespeed 1.11.33.4-0 #31223] Serf status 120171(APR does not understand this error code) polling for 1 threaded fetches for 0.05 seconds
[Mon Jul 03 20:45:49.910183 2017] [pagespeed:warn] [pid 31225:tid 112490799363840] [mod_pagespeed 1.11.33.4-0 #31225] Fetch timed out: https://www.example.com/wp-includes/js/jquery/jquery.js?ver=1.12.4 (connecting to:139.xx.xx.xx:82) (1) waiting for 50 ms
Not sure whats going on here.
I think you have to understand the cache flow when using both varnish and page_speed.
Please check the link bellow for details:
https://www.sonassi.com/help/troubleshooting/understanding-cache-flow-when-using-pagespeed-and-varnish
Clear all page_speed cache and varnish cache, then restart both varnish and apache.

Apache2 and mod_wsgi: Truncated or oversized response headers received from daemon process

My application is running with an Apache 2 server using mod_wsgi, Flask, and Python 2.7. Oddly enough, the application crashes when the page refreshes. For me, this happens exactly on every other refresh. You can see it here. Furthermore, in Chrome, if I open the web inspector tool, the program does not crash.
In the logs, I see:
[Tue Apr 14 13:45:29.137444 2015] [wsgi:error] [pid 32713] [client 146.203.54.32:58816] Truncated or oversized response headers received from daemon process 'localhost:80': /etc/g2e/htdocs/g2e
[Tue Apr 14 13:45:29.671493 2015] [core:notice] [pid 28845] AH00052: child pid 640 exit signal Segmentation fault (11)
[Tue Apr 14 13:45:29.671520 2015] [wsgi:info] [pid 28845] mod_wsgi (pid=640): Process 'localhost:80' has died, deregister and restart it.
[Tue Apr 14 13:45:29.671524 2015] [wsgi:info] [pid 28845] mod_wsgi (pid=640): Process 'localhost:80' terminated by signal 11
[Tue Apr 14 13:45:29.671527 2015] [wsgi:info] [pid 28845] mod_wsgi (pid=640): Process 'localhost:80' has been deregistered and will no longer be monitored.
...
FWIW, I am using
Linux 3.16.7-7-desktop #1 SMP PREEMPT Wed Dec 17 18:00:44 UTC 2014 (762f27a) x86_64 x86_64 x86_64 GNU/Linux
Any help is appreciated.
I may have a tweak. I had this problem but now it's working somehow.
I tried to run mod_wsgi as a daemon. My application didn't work and I had this error message in the logs.
however running mod_wsgi as non-daemon worked, for instance
python manage.py runmodwsgi --reload-on-changes # for Django
So I once again launched it then killed it.
my app is still running :)
(mod_wsgi 4.4.[1-13], apache2, python 2.7, Django 1.7, Debian8 fresh install, with or without virtualenv)

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.

Premature End of Script Headers from git-http-backend

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.