views:

504

answers:

3

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

Also, side question, where the the Apache script file that is basically the "exe" that linux executes? I'm trying to intergrate my server with Aptana Studio, and it requires the path to the Apache install. I know in Windows, this would be "C:\path\to\httpd.exe", but I don't know how this works in linux.

+6  A: 

Is your server listening on port 80? (Usually) only root is allowed to open ports below 1024. Hence the need for sudo.

As you can see, lots of people wonder how to get around this. One possible solution is to perform port-forwarding on your router. (I'm assuming here that you are behind a router...). Then incoming connections on port 80 can be forwarded to e.g. port 8080. Thus only locally does one need to connect to port 8080. (There may be more elegant solutions... somebody else will post them.)

Stephan202
interesting, so what's the best way to work around this? i like not having to type out localhost:8080, but is that a better alternative than trying to grant permission to my account to open port 80? seems like this would be a common issue, just wondering how people work around it.
Bialecki
A: 

I think generally (on both OS X and Linux - I'm not sure which one you're referring to) the httpd binary is located at: /usr/sbin/httpd

If you need to be able to restart Apache, and you can't do so as root (for whatever reason..), then you may have to settle for a non 'well known' port.

Joe Freeman
A: 

try this

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

password should stored in passfile

Rinu
i am not sure about this
Rinu