MAMP - Mac OS X

2020-07-18 02:57发布

I have been using MAMP for sometime now on port 8888 so I visit website in the browser like so: http://localhost:8888/website

However I have just installed a Wordpress Multisite and therefore want to switch to port 80 to allow me to visit the websites as normal and have sub directories e.g. http://website.co.uk, http://subdomain.website.co.uk

I have setup the vhosts file within MAMP and changed the port to 80 in the MAMP preferences but ever since doing this MAMP will not start Apache. MySQL starts up fine but Apache fails to start.

I have tried to start apache manually by running the following command in terminal:

sudo ./startApache.sh

but everytime I do this I get the following errors:

(48)Address already in use: make_sock: could not bind to address [::]:80
(48)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs

If I switch back to port 8888 MAMP works again. Can anyone point me in the right direction to get this fixed?

sudo lsof | grep LISTEN

launchd      1           root   11u     IPv6  0x8754c7c05566afd       0t0      TCP *:afpovertcp (LISTEN)
launchd      1           root   12u     IPv4  0x8754c7c0556bae5       0t0      TCP *:afpovertcp (LISTEN)
launchd      1           root   30u     IPv6  0x8754c7c0556671d       0t0      TCP localhost:ipp (LISTEN)
launchd      1           root   31u     IPv4  0x8754c7c0556b3ad       0t0      TCP localhost:ipp (LISTEN)
httpd       21           root    4u     IPv6  0x8754c7c0556633d       0t0      TCP *:http (LISTEN)
kdc         43           root    6u     IPv6  0x8754c7c05565f5d       0t0      TCP *:kerberos (LISTEN)
kdc         43           root    8u     IPv4  0x8754c7c0556a53d       0t0      TCP *:kerberos (LISTEN)
httpd      191           _www    4u     IPv6  0x8754c7c0556633d       0t0      TCP *:http (LISTEN)
Dropbox    293            Ell   19u     IPv4  0x8754c7c0a8db6cd       0t0      TCP *:17500 (LISTEN)
Dropbox    293            Ell   25u     IPv4  0x8754c7c0a8da125       0t0      TCP localhost:26164 (LISTEN)
mysqld     454            Ell   10u     IPv4  0x8754c7c0ba8085d       0t0      TCP *:ddi-tcp-2 (LISTEN)

Update:

ps 21
PID   TT  STAT      TIME COMMAND
21   ??  Ss     0:00.39 /usr/sbin/httpd -D FOREGROUND

Thanks

2条回答
家丑人穷心不美
2楼-- · 2020-07-18 03:58

In my case, there was nothing to be found when using grep on lsof.

I've been looking for a few hours to find what was creating the Listen directives to overlap but without result.

So I've used a quickfix, and that was to change my Listen port in httpd.conf to 8000

Listen 8000

change that, and restart your apache2. Should do the trick...

查看更多
Melony?
3楼-- · 2020-07-18 04:02

You can check what processes that are listening on what ports with lsof:

sudo lsof | grep LISTEN

Look for processes listening on *:http etc.

Update:

You see that one process is already using *:http which is a process named httpd with pid 21. httpd is most likely a Apache process. So I would guess that your system already have an Apache installation somewhere (that might auto start) or that the MAMP Apache is already running for some reason.

Try to run ps 21 to get more information about the process. On my system where I have MAMP installed an running I see this: (65696 is the pid of httpd on my system).

mattias@waderbook:~$ ps 65696
  PID   TT  STAT      TIME COMMAND
65696   ??  Ss     0:00.57 /Applications/MAMP/Library/bin/httpd -k start

If you see /usr/sbin/httpd it is likely the Apache bundled with OS X that is running. Try to disable it by going to "Sharing" in Preferences and disable "Web sharing".

查看更多
登录 后发表回答