Replacing Mac OS Apache with macports Apache

Kirk Stork kastork at nps.edu
Sat Feb 13 20:13:33 PST 2010


I didn't ask the questions, but still... great set of answers Ryan.  Thanks

I have been scratching my head as to how to integrate MacPorts into an OS X Server set up.  This helps a bit, although there are still questions in my mind about all the other services that come with OS X Server.


On Feb 13, 2010, at 4:58 PM, Ryan Schmidt wrote:

> On Feb 13, 2010, at 18:14, David Vergnaud wrote:
> 
>> I just just installed the PHP library imagick on my Mac Mini running a standard Leopard (10.5.8) system featuring apache 2.2.13 and php 5.2.11. While installing imagick, macports also built new versions of apache (2.2.14) and php (5.3.1) into /opt/local, so I now have two concurrent versions of each of these programs. 
>> 
>> I haven't gone any further yet, so the "legacy" web server (/usr/sbin/httpd) is still running, and it still uses the "legacy" php version (/usr/bin/php). I have nothing against updating to the newer versions, however before I do I want to make sure I won't be breaking any dependencies or creating conflicts. 
>> 
>> So here's my question: how should I proceed for a clean update? Here are my uncertainties so far:
>> - how can I make sure that the apache daemon lauched at startup is the proper one? While building apache2 port reported that the new daemon was ready for activation, but most probably it won't disable the former one automatically?
> 
> Correct, the apache2 port has installed a launchd plist for you which you can use to start the MacPorts apache2 server. MacPorts does not start it for you automatically, nor will it touch your existing Apple apache server.
> 
> Disable the Apple apache server using the Sharing section of System Preferences. Then activate the MacPorts apache server using the command that was displayed to you when you installed the apache2 port, or more simply:
> 
> sudo port load apache2
> 
> This will start the MacPorts apache2 server now and at every subsequent system startup or restart.
> 
> This assumes you have already set up your /opt/local/apache2/conf/httpd.conf; if you have not, you should do so first.
> 
> To stop the server now and prevent it from starting in the future, use:
> 
> sudo port unload apache2
> 
> 
>> - should I set a new location for the httpd.conf file? I was using /etc/apache2/httpd.conf, the new one is located in /opt/local/apache2/conf/httpd.conf, and I couldn't find the location where this path can be set (at least I didn't see it in apachectl). 
> 
> You cannot specify the location of the httpd.conf file. The Apple apache server simply requires the file to be located in /etc/apache2/conf, and the MacPorts apache server requires it to be in /opt/local/apache2/conf.
> 
> 
>> - what should I do with the content of the /etc/apache2 directory? Is there anything I should transfer to the new root directory, or anything that should remain there? Somehow I don't feel comfortable having two concurrent installations on the system, especially if the one running is not the one in the standard location.
> 
> That is, nevertheless, the way MacPorts is designed to function. After shutting down your Apple apache server, you simply leave it off. You can do whatever you like with the contents of /etc/apache2, but MacPorts won't attempt to use anything from that directory. If there are files in there that are required for your web server setup, copy them to the right place within /opt/local/apache2.
> 
>> - the same question goes for php and the possible libraries it carries with itself. Wouldn't it be better to move that from /opt/local to some more standard location?
> 
> /opt/local is the standard location for all software installed by MacPorts. You can change it to another location at MacPorts install time, but not after you have already installed ports. And anyway you'd only be changing /opt/local to some other non-system location. You do not install MacPorts into a system location like /usr. MacPorts needs to be isolated from the rest of the system.
> 
>> Afaik only my .tcshrc file has been modified to include the new directory in the PATH,
> 
> Correct, if your shell is tcsh. If your shell is bash, then your .bashrc has been modified.
> 
>> that means this new version is not available for processes not running in a terminal or that know the explicit path.
> 
> That is correct.
> 
>> What would be the best way to avoid that?
> 
> I don't think "avoid" is the right word. Rather, you should inform any other processes that need to use MacPorts software what the correct path to that software is.
> 
>> - wouldn't it be just easier to simply include the imagick library into the existing/working environment to avoid all these problems? Are there known dependencies/requirements that would prevent this from running? If not, could anyone tell me exactly what files should be moved and where?
> 
> By design, MacPorts uses its own stack of libraries; this *reduces* problems by ensuring all MacPorts users are running the same versions of everything and that any Apple software updates do not disrupt MacPorts-installed software. We do not support attempting to install, say, the php5 imagick library into your Apple-provided Apache server running Apple-provided PHP. If you want to try that, you're on your own.
> 
> I recommend you use the MacPorts Apache / PHP stack as it is designed to be used, separately from the Apple software. Have you already read the documentation on setting up this stack with MacPorts? You may want to see if there are any steps you missed:
> 
> http://trac.macports.org/wiki/howto/MAMP
> 
> 
> _______________________________________________
> macports-users mailing list
> macports-users at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macports-users



More information about the macports-users mailing list