It's not so much your version of Apache/PHP have been reverted - it's just the wrong version is loaded.
If you have Mac OS X's Web Sharing enabled it will auto enable the version of Apache and PHP Apple provides using the LaunchDaemon org.apache.httpd.plist
in /System/Library/LaunchDaemons
(this will override MacPorts version). You'll want to disable this by either turning off Web Sharing in the Sharing Preference Pane or by running sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
.
When you installed Apache for MacPorts it installed a LaunchDaemon into /Library/LaunchDaemons
which if enabled will start up the MacPorts version of Apache automatically. To enable it run sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist
and you're off to the races.
If you're running apachectl
to restart - make sure you've selected the right version. You may need to alter your $PATH to have /opt/local/apache2/bim
before /usr/sbin
As for what version of PHP is being used; on the command line this will depend on your $PATH while for Apache it's entirely in your configuration of where the libphp5 module is. (/etc/apache2/
for the built in version, /opt/local/apache2/conf
for the version MacPorts installed)
Generate a host key
First, make a home for the new SSL files. I use /etc/apache2/ssl. Open up a terminal window, cd to the new directory and issue the following command to create a host key file.
sudo ssh-keygen -f host.key
Generate a certificate request file
This command create a certificate request file. A certificate request file contains information about your organization that will be used in the SSL certificate.
sudo openssl req -new -key host.key -out request.csr
Create the SSL certificate
Create a self signed SSL certificate using the request file.
sudo openssl x509 -req -days 365 -in request.csr -signkey host.key -out server.crt
Configure Apache
Create a backup of /etc/apache2/httpd.conf.
Append the contents of /etc/apache2/extra/httpd-ssl.conf to /etc/apache2/httpd.conf.
In /etc/apache2/httpd.conf, make sure the loading of SSL is enabled (remove the #)
LoadModule ssl_module libexec/apache2/mod_ssl.so
Also, edit SSL section to use the new certificate.
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/server.crt
SSLCertificateKeyFile /etc/apache2/ssl/host.key
Check the config and restart Apache to try the new certificate.
sudo apachectl configtest
sudo apachectl restart
Thanks to the House of Ding and Matt Langtree for providing much of this solution.
Best Answer
Things do doublecheck:
1. File permissions
The specified path for the new document root should allow at least read access for the Apache user, which is _www by default. You probably want to
chmod 755 /Users/jonathan/mirror
if the file permissions are too restrictive. What are the actual file permissions on the directory and files?2. Virtual hosts
When you enable name based virtual hosts, the document root in the main config is ignored. Instead the root for the matching hostname will be used, and if none match it will default to the first virtual host.