I just needed an apache webserver with PHP 5.6 and some virtual hosts on my Mac running OSX El Capitan. The native OSX apache version comes with an older version of PHP which has no xdebug support, so I shut it down with
sudo apachectl stop
Installation
I installed the following ports:
sudo port install apache2 php56 php56-apache2handler php56-xdebug
Apache configuration
After installing the following commands are needed:
cd /opt/local/apache2/modules sudo /opt/local/apache2/bin/apxs -a -e -n php5 mod_php56.so
After that, the following changes must be made to /opt/local/apache2/conf/httpd.conf:
# add the following line where the modules are loaded LoadModule php5_module modules/mod_php56.so #add the following line Include conf/extra/mod_php56.conf # set the ServerName ServerName myhost.local #uncomment the following line to have vhost configurations: Include conf/extra/httpd-vhosts.conf
In the file /opt/local/apache2/conf/extra/httpd-vhosts.conf configure the virtual hosts:
<VirtualHost *:80> DocumentRoot "/path/to/where/the/docs/are" ServerName myvhost <Directory /> DirectoryIndex index.html index.php AllowOverride All Options All Allow from all </Directory> </VirtualHost>
And don’t forget to add the virtual host name (myvhost) as an alias to localhost in /etc/hosts.
The configuration can be checked with
/opt/local/apache2/bin/apachectl -t
Starting and stopping the server is done with:
sudo port load apache2 sudo port unload apache2
PHP configuration
in /opt/local/etc/php56 copy one of the provided sample files to php.ini and adjust it, especially the date.timezone setting. To configure xdebug, add the following section to php.ini (make sure the path to xdebug.so matches the installed version):
zend_extension="/opt/local/lib/php56/extensions/no-debug-non-zts-20131226/xdebug.so" xdebug.remote_enable=1 xdebug.remote_port="9000" xdebug.profiler_enable=1 xdebug.profiler_output_dir="some/output/dir"