After the weekend, AMPPS Apache stopped running on Mac Mojave.
I've run the command lsof -nP -i4TCP:80 | grep LISTEN and received nothing back, I believe that means nothing is running on port 80.
There is nothing in the Apache error log.
I've restored Apache & PHP to default configuration through the AMPPS control panel and the issue remains.
I've reinstalled the latest version of AMPPS for Mac and the issue remains.
Help appreciated.
This was solved by installing the most recent version of AMPPS, 3.9, which is compatible with the latest version of macOS.
apache use port 80, in my case another app used port 80 i killed it by following command:
kill -kill `lsof -t -i tcp:80`
Related
A security sweep of my network (using Nessus) revealed that my mac is running a version of Apache (2.4.46) with a few critical vulnerabilities. I've been told I need to upgrade to at least 2.4.47. I'm having issues getting MacOS to use the upgraded version over the default one:
The default httpd is located at /usr/sbin/, which is read only even as root. As far as I'm aware upgrading the default Mac OS version is not a possibility.
Installed a newer version of Apache (v2.4.48) using Homebrew. The homebrew version is located in /usr/local/bin/httpd and as long as /usr/local/bin is before /usr/sbin in the env path it should be the preferred version.
Running httpd -v in the terminal returns v2.4.48, but the vulnerability scan is still picking up the old version of Apache
What am I missing? Why is the OS picking up the old version? Do I simply have to wait for Apple to patch it? Is it even possible to upgrade /usr/sbin/httpd?
Two things here, how to set the default apache version, and whether your machine is vulnerable.
firstly, you can have multiple versions of apache installed, and even running simultaneously (listening on different ports). Installing homebrew apache, doesn't necessarily start the server automatically, or deactivate the default (apple) apache install.
You can see which versions of apache are running on your system by using the ps command, for example on my machine:
$ ps auxw | grep httpd
_www 782 0.0 0.0 34153280 1476 ?? S 26May22 0:00.83 /usr/sbin/httpd -D FOREGROUND
and check the version:
$ /usr/sbin/httpd -v
Server version: Apache/2.4.53 (Unix)
The apple httpd service is started by launchctl, and you can stop the apple httpd service from automatically starting up as follows:
$ sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
To automatically start homebrew apache on system startup (assuming you have already installed it - brew install httpd), run brew services start httpd
Remember that the apache configuration files will be in a different location - apple conf file is /etc/apache2/httpd.conf, whereas homebrew's is in /usr/local/etc/httpd/httpd.conf. Also the default port may well be different - apple defaults to port 80 whereas homebrew httpd listens on port 8080 by default.
Secondly, does this security issue actually matter? By default apache listens on all network interface, but unless you need to access the web server from another machine, it is safer to configure it to only listen on localhost. You can do this in the httpd.conf file, as follows:
Listen 127.0.0.1:80
This page has a good walkthrough of the various steps: https://wpbeaches.com/installing-configuring-apache-on-macos-using-homebrew/
Via brew I installed an Apache Server with PHP 7.4 running, however it seems that there are two servers and two different PHP versions running.
On localhost phpinfo() shows 7.4 however on 127.0.0.1 phpinfo() shows 7.3
The localhost phpinfo() shows it's running on brew, however on 127.0.0.1 it seems that the built-in Apache is running, it shows Built-in HTTP server
Stopping Apache via sudo apachectl stop stops the brew one from working (localhost), but the built-in (127.0.0.1) is still running it seems.
which -a apachectl shows
/usr/local/bin/apachectl
/usr/sbin/apachectl
Any tips on how to stop the built-in one and only have the brew one running are gladly welcomed!
Thx!
manager-osx flicks from "Starting…" back to "Stopped" with no error, and when I run sudo /Applications/XAMPP/xamppfiles/ctlscript.sh start apache on the command line, I get back:
Syntax OK
/Applications/XAMPP/xamppfiles/apache2/scripts/ctl.sh : httpd started
I've tried port swapping and running sudo apachectl stop to stop the built in server (as described at XAMPP can't start Apache in mac), but no luck. Open port scan doesn't show any live Apache servers on my machine. I've reinstalled XAMPP (multiple different versions), but nothing.
Running macOS Catalina 10.15.1.
Update: I've also tried using MAMP, and it can't start Apache either.
sudo /Applications/XAMPP/xamppfiles/xampp start
run this command to Start XAMPP on MacOS Catalina.
There is another version of apache running on my system.
When in run sudo apachectl stop I still get the "It Works" page
So I found the location of the other version that is still running and it looks to be an older version which probably came pre-installed and is located in /opt/local/apache2/.
I tested this file /opt/local/apache2/htdocs/index.html.sample by just changing the text and then checked the browser again.
Server: Apache/2.2.29 (Unix)
I want to remove that one and keep the latest version which is located in private/etc/apache2
Server version: Apache/2.4.9 (Unix)
How can I do this safely.
I managed to fix this
I ran ps aux | grep apache to see the apache processes
I then ran sudo apachectl stop
Then sudo killall -9 httpd to kill all apache processes
Then sudo apachectl restart
I went to the browser and typed localhost~/username/sitename
Bingo it works again, my system is using the correct version of apache again!
I am using Mac OS X 10.7.3. I installed tomcat6 via macports 2.0.4. I put the tomcat6 location in myeclipse for spring 10 server configuration. Everything was fine so far.
Then I tried to start it in myeclipse. It could not start, saying something like 8080 port is already in use.
Then I went to terminal.
ps aux | grep tomcat
4 process showed up. It seemed tomcat6 started automatically after the installation. Then I tried to stop it with
sudo tomcatctl stop
Here came the problem. No matter how I tried, it always says
Stopping Tomcat...(pid ****)............... giving up.
I tried to kill the process but it kept starting tomcat again right after the kill.
How do I stop it and let myeclipse take over it? Any help is appreciated.
Thanks,
Milo
try doing sudo port unload tomcat6
This command replaced interacting with launchctl yourself, but im unsure if it supports a -w switch which would typically remove the launch daemon were it used with launchctl unload meaning you wouldnt run into the magic restart problem.