0

I removed MacPorts completely following their guideline here. uninstaling all ports and then removing all folders

sudo rm -rf \ /opt/local \ /Applications/DarwinPorts \ /Applications/MacPorts \ /Library/LaunchDaemons/org.macports.* \ /Library/Receipts/DarwinPorts*.pkg \ /Library/Receipts/MacPorts*.pkg \ /Library/StartupItems/DarwinPortsStartup \ /Library/Tcl/darwinports1.0 \ /Library/Tcl/macports1.0 \ ~/.macports

I then installed homebrew, dnsmasq and MySQL. The latter two I installed using Brew and Apache I wanted to run natively. Now the isue seems to be that Apache is still running via Macports.

ps ax | grep httpd
  254   ??  Ss     0:00.72 /opt/local/apache2/bin/httpd -k start
  258   ??  S      0:00.02 /opt/local/apache2/bin/httpd -k start
  259   ??  S      0:00.01 /opt/local/apache2/bin/httpd -k start
  262   ??  S      0:00.01 /opt/local/apache2/bin/httpd -k start
 1811   ??  S      0:00.01 /opt/local/apache2/bin/httpd -k start
 1812   ??  S      0:00.01 /opt/local/apache2/bin/httpd -k start
 1818   ??  S      0:00.01 /opt/local/apache2/bin/httpd -k start
 1820   ??  S      0:00.01 /opt/local/apache2/bin/httpd -k start
 1826   ??  S      0:00.02 /opt/local/apache2/bin/httpd -k start
 1857   ??  S      0:00.02 /opt/local/apache2/bin/httpd -k start
 2336   ??  S      0:00.01 /opt/local/apache2/bin/httpd -k start
 3720 s000  S+     0:00.00 grep httpd

This although all ports have been removed as well as all folders related to MacPorts. I also think all launchers have been removed. How could httpd be loaded now?

Other issue is that the DocumentRoot does not load the default documentRoot DocumentRoot "/Library/WebServer/Documents" from /etc/apache2/httpd.conf nor /private/etc/apache2/httpd.conf . It seems to load the old MacPorts documentRoot, but from where? All files and folders are gone as far as I know. And when I check for it, it does show the new DocumentRoot

sudo apachectl -V | grep -i SERVER_CONFIG_FILE | cut -f2 -d'"' | xargs grep -i '^DocumentRoot' | cut -f2 -d'"'
/Library/WebServer/Documents

And when I unloaded and loaded OSX's Apache I did get an error message showing my vhost was loaded:

sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
Password:
jaspersmbp:etc jasper$ sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist
jaspersmbp:etc jasper$ apachectl
AH00112: Warning: DocumentRoot [/usr/docs/dummy-host.example.com] does not exist
AH00112: Warning: DocumentRoot [/usr/docs/dummy-host2.example.com] does not exist
AH00526: Syntax error on line 41 of /private/etc/apache2/extra/httpd-vhosts.conf:
Invalid command 'VirtualDocumentRoot', perhaps misspelled or defined by a module not included in the server configuration

But opening localhost still loads wrong or old DocumentRoot

Here the hosts file atm

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1   localhost jaspersmbp.local wordpress.local joomla.local
255.255.255.255 broadcasthost
::1             localhost
fe80::1%lo0 localhost

# My local aliases

And here the VirtualHost at /etc/apache2/extra/httpd-vhosts.conf I added to loaded local domains with *dev on the fly

<Virtualhost *:80>
    DocumentRoot "/Users/jasper/webdesign"
    ServerName vhosts.dev
    ServerAlias *.dev
    UseCanonicalName Off
    LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
    ErrorLog "/Users/jasper/webdesign/vhosts-error_log"
    <Directory "/Users/jasper/webdesign/*">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</Virtualhost>

Running apachectl seems to restart MacPorts' Apache, but I cannot find it in .bashrc nor .bash_profile in my $PATH.

And my PATH

echo $PATH
/Users/jasper/.rvm/gems/ruby-2.1.1/bin:/Users/jasper/.rvm/gems/ruby-2.1.1@global/bin:/Users/jasper/.rvm/rubies/ruby-2.1.1/bin:/usr/local/heroku/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/jasper/.rvm/bin

Questions are:

  1. How can I stop the wrong ghost Apache daemon
  2. How can I find where the document root is really loaded from and change?
0

I found https://discussions.apple.com/thread/6602475 indicating that to stop both httpd processes from stopping and to stop the error I saw in my log stating

11/24/14 4:53:29.105 PM com.apple.xpc.launchd[1]: (org.apache.httpd) Service only ran for 0 seconds. Pushing respawn out by 10 seconds.

that I had to use

sudo apachectl stop
sudo killall -9 httpd

the main things seems to have been that I needed to killall old running httpd processes. After that new hosts created in the host file started to work just fine.

And when I checked for the daemon I saw:

ps ax |grep httpd
 5798   ??  Ss     0:00.30 /usr/sbin/httpd -D FOREGROUND
 5799   ??  S      0:00.00 /usr/sbin/httpd -D FOREGROUND
 5800   ??  S      0:00.00 /usr/sbin/httpd -D FOREGROUND
 5801   ??  S      0:00.00 /usr/sbin/httpd -D FOREGROUND
 5802   ??  S      0:00.00 /usr/sbin/httpd -D FOREGROUND

again. Finally OSX is running the Apache show again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.