last day (15 days later) » 

6:05 PM
0
Q: localhost port 8080 doesn't respond but using 127.0.0.1:8008 does work

pixel 67When I try to access locahost:8080, I get The localhost page isn’t working localhost didn’t send any data. ERR_EMPTY_RESPONSE but if I try: 127.0.0.1:8080, I get the response I'm looking for I believe this has something to do with the httpd (apache) that I just updated with homebrew httpd2...

 
does "ping localhost" resolve to 127.0.0.1 ? You can check /etc/hosts as well.
 
Yes, ping localhost resolves to 127.0.0.1 127.0.0.1 localhost 255.255.255.255 broadcasthost
 
Did you have old config files which define a virtual host? Or is there anything in the apache log files? Do you see anything happening when you tail all log files and try to access localhost? "tail -f /usr/local/var/log/apache2/*"
 
I'm not sure, not really knowledgeable about the server configs, just fiddle until I get things working Here is a link the result when I run the tail call: gist file
 
It looks like there is still another process running which uses the ports. So I guess you would need to shut it down first
 
6:05 PM
I did a ps aux | grep localhost:8080 <code><pre> → ps aux | grep localhost:8080 tony 66074 0.0 0.0 2444056 700 s003 U+ 12:52PM 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude -dir=.git --exclude-dir=.hg --exclude-dir=.svn localhost:8080 </pre></code>
 
Look for the process with: "ps -aef | grep httpd | grep -v grep". Since the process of apache is called httpd and not localhost
You can kill the runnig apache with the following command: ps -aef | grep " httpd " | grep -v grep |kill $(awk '{print $2}')
 
This is the link to the output Sorry for the formatting, so I should just run kill on all httpd process?
 
Yeah, since there is another apache process running, you cannot start your updated version. You need to stop or if that doesn't work kill them, before you can start your new server with apachectl start
 
Ok, that makes sense. I'll try. Thanks for the help, I appreciate it!
 
No worries, the command: * ps -aef | grep " httpd " | grep -v grep |kill $(awk '{print $2}') * Should work and do the job for you. After that you can start the new apache with * sudo apachectl -k restart *
 
6:05 PM
seems to be taking a long time to run that command, nothing happening yet
I have most of Apache and PHP stuff installed with homebrew if that helps at all?
 
If it's taking a long time, then it most probably tries to restart every killed apache process. Can you just try to shut it down with: * sudo apachectl stop * and check for running processes afterwards ?
hey :)
 
Hi
so, I got this
httpd (pid 39269?) not running
 
are there still processes running ? When you try the command from before ?
ps -aef | grep httpd | grep -v grep
 
0 82 1 0 7:19AM ?? 0:00.93 /usr/sbin/httpd -D FOREGROUND
501 247 82 0 7:19AM ?? 0:00.01 /usr/sbin/httpd -D FOREGROUND
501 3659 82 0 7:22AM ?? 0:00.00 /usr/sbin/httpd -D FOREGROUND
501 3660 82 0 7:22AM ?? 0:00.00 /usr/sbin/httpd -D FOREGROUND
501 3662 82 0 7:22AM ?? 0:00.31 /usr/sbin/httpd -D FOREGROUND
501 3663 82 0 7:22AM ?? 0:00.01 /usr/sbin/httpd -D FOREGROUND
501 3664 82 0 7:22AM ?? 0:00.01 /usr/sbin/httpd -D FOREGROUND
yeah, looks like the httpd24 from homebrew
 
yeah, that's what i thought. The process identification file is stale, so got old informations and therefore it cannot kill the apache server running
you can kill them manually with:
kill -9 247 3659 3660 3662 3663 3664
afterwards you should be able to use sudo apachectl stop && sudo apachectl start
 
6:08 PM
do I just copy that and paste into my terminal?
 
yep
that just kills them all in once. and then restarts the server
 
I'm using brewservices to handle that for me
 
yeah, but brewservices and all other things are using PID files to "find their processes"
if the file is stale and the pid cannot be found ( httpd (pid 39269?) not running) then it cannot do anything
 
ok, just wanted to make sure
 
otherwise you could just restart your mac
that would help as well
 
6:10 PM
ok
I ran the
kill -9 247 3659 3660 3662 3663 3664
then did the `sudo apache stop` and got
httpd (pid 39269?) not running
I'm almost ready to reinstall the OS lol
I had tomcat and nginx installed before and ever since then, could never really get localhost:8080 to work
any other port works just fine
werid
localhost: 3000, 3034 etc
https://getgrav.org/blog/macos-sierra-apache-multiple-php-versions
helped
but I had to use 127.0.0.1:8080
 
have you done the start command as well ?
 
I didn't
 
doesn't matter if it says that it's not running
do it and check :)
 
should I restart the computer too?
 
should be fine again
 
6:14 PM
ok :)
 
no just do this first
and check for localhost
you can also check the logs again, it should restart properly now
 
httpd not running, trying to start
(48)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(48)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Never seen that before
 
brb, my son is calling me
 
you did it with sudo ?
sure
 
6:19 PM
Hi, srry
yep, ran sudo
 
no worries.
hm
I honestly would suggest to uninstall it properly with homebrew first and then reinstall the package
something went wrong, maybe the service definitions are not updated to the new path or something
 
→ sudo apachectl start
(48)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(48)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
sudo apachectl restart
httpd not running, trying to start
(48)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(48)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
 
you said you updated it, right?
 
yep
with those instructions
I didn't update to Sierra yet
but I figured it would straighten out my local dev
I rarely do PHP stuff
it's mostly JavaScript
and Ruby or Python
I just have PHP and Apache for one site, I'm still maintaining
uggg
 
hmpf
 
6:22 PM
lol
 
sorry, just loked something up
and sound pretty much like my old dev days
one site still using php and still having all the stuff around for it
 
:)
I know
 
but two suggestions I've got for you
 
ok
 
1.) Uninstall the httpd24 package completely and check if still are httpd process running after a restart. If so it's not completely removed
check the files under: /System/Library/LaunchDaemons/
there must be something with httpd in the name. remove it with sudo and reboot
it should not come back afterwards
 
6:25 PM
ok, let me try
 
the second opinion is if it's only for one site
uninstall apache and stuff
and just install php
inside the directory just do an php -S localhost:8000
that starts the development server
and doesn't run all the time, costs you battery power etc
 
ok
sounds good
 
since it only runs when you use it
it's the same as the runserver in django or ruby
 
yeo
yep
okay. let me try option 1 first :)
 
and you don't have to maintain more and more running processes
 
6:27 PM
thanks again for your help
 
alright :)
 
have a good day :)
 
you too
 

last day (15 days later) »