Why is running "apachectl -k start" not working but "sudo apachectl -k start" doing?

I am working on my OS X with the default Apache installation. For some reason, when I run the "apachectl" command without "sudo", I get "no listening sockets available / unable to open logs". I'm guessing this is a permissive thing, so can someone help me? I am using Apache 2.2.

Also, side question, where is the Apache script file which is basically an "exe" that linux runs? I am trying to link my server to Aptana Studio and it requires the path to the Apache installation. I know on Windows it will be "C: \ path \ to \ httpd.exe", but I don't know how it works on Linux.

0


a source to share


3 answers


Is your server listening on port 80? (Usually) only root is allowed to open ports below 1024. Hence, it is required sudo

.



As you can see , a lot of people are wondering how to get around this. One possible solution is to perform port forwarding on your router. (I assume you are behind a router ...). Then incoming connections on port 80 can be forwarded, for example. port 8080. So only locally needs to connect to port 8080. (There might be more elegant solutions out there ... someone else will post them.)

+6


a source


I think that in general (for both OS X and Linux - I'm not sure which one you are linking to) the httpd build is located at: / usr / sbin / httpd



If you need to restart Apache, and you cannot do so as root (for whatever reason ..), then you may have to settle for a not "well known" port.

0


a source


try it

(with php) $ a = shell_exec ('sudo -u root -S / etc / init.d / apache2 restart </ home / $ user / passfile');

the password must be stored in passfile

0


a source







All Articles