Apache 2 - am I doing it wrong?

Bradley Giesbrecht brad at pixilla.com
Fri Sep 11 12:18:01 PDT 2009


On Sep 11, 2009, at 3:09 PM, Scott Haneda wrote:

> On Sep 10, 2009, at 4:17 PM, Chris Janton wrote:
>
>> On 2009-09-10 , at 10:28 , Scott Haneda wrote:
>>
>>> First issue, reloading I use apachectl. Often times I forget to cd  
>>> to the macports area and enable Apples distro. Is chmod -x  
>>> apachectl sufficient to solve that?
>>>
>>> I can move, rename, symblink, or alias, but wanted opinions on the  
>>> suggested way.
>>
>> mac 2 # ps -axww | grep [h]ttpd
>> 237 ??         0:03.47 /opt/local/apache2/bin/httpd -k start
>
> [snip...]	
>
>> mac 3 # sudo /opt/local/apache2/bin/apachectl graceful
>> mac 4 # ps -axww | grep [h]ttpd
>> 237 ??         0:03.63 /opt/local/apache2/bin/httpd -k start
>
> [snip...]	
>
>> 9019 ??         0:00.00 /opt/local/apache2/bin/httpd -k start
>>
>> mac 7 # ps -axww | grep [a]pache
>>  69 ??         0:00.37 /opt/local/bin/daemondo --label=apache2 -- 
>> start-cmd /opt/local/etc/LaunchDaemons/org.macports.apache2/ 
>> apache2.wrapper start ; --stop-cmd /opt/local/etc/LaunchDaemons/ 
>> org.macports.apache2/apache2.wrapper stop ; --restart-cmd /opt/ 
>> local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper  
>> restart ; --pid=none
>> 237 ??         0:03.64 /opt/local/apache2/bin/httpd -k start
>> 9015 ??         0:00.00 /opt/local/apache2/bin/httpd -k start
>
> [snip...]	
>
>> I use apachectl graceful a *lot* and have not ever had difficulty  
>> with launchctl (mysql, a different story)
>
> Care to share the MySql issues?
>
>> If you change permissions on /usr/sbin/apachectl like this
>>
>> mac 11 # sudo chmod -x /usr/sbin/httpd
>> mac 12 # apachectl
>> /usr/sbin/apachectl: line 119: /usr/sbin/httpd: Permission denied
>
> I may, last resort until I understand what is going on here.
>
>> you will get the reminder you need to actually execute /opt/local/ 
>> apache2/bin/apachectl
>>
>> or you could just put this in your profile
>>
>> alias apachectl=/opt/local/apache2/bin/apachectl
>
>
> First thing I did, but it does not seem to work
> $grep apache .bashrc
> alias apachectl='/opt/local/apache2/bin/apachectl'
>
> Not sure if `which` looks at aliases first:
> $which apachectl
> /usr/sbin/apachectl
>
> sudo apachectl graceful started the OS X Apache
> _www     78366   0.0  0.0  2700828    724   ??  S    11:57AM    
> 0:00.00 /usr/sbin/httpd -D FOREGROUND
> root     78365   0.0  0.1  2700828   3992   ??  Ss   11:57AM    
> 0:00.59 /usr/sbin/httpd -D FOREGROUND
>
> It also took over the MacPorts one.  How come I do not get a port 80  
> conflict to begin with?
>
> /opt/local/apache2/bin/httpd -k graceful
> /opt/local/apache2/bin/httpd -k graceful
> /opt/local/apache2/bin/httpd -k graceful
>
> I never understood that, and still do not.
>
> I went ahead and sudo chmod -x /usr/sbin/httpd, then ran sudo  
> apachectl graceful, no error, and it seems to have not started  
> Apple's Apache.
>
> How would I get this to reflect the /opt location?
> $whereis apachectl
> /usr/sbin/apachectl

Just put /opt/local/apache2/bin/ at the front of your PATH env var.

// Brad


More information about the macports-users mailing list