I had a lot of trouble upgrading my XAMPP to run the latest PHP. So much so, that I decided to document what I did.
First off, I downloaded the Mac version of XAMPP available from Apache Friends. I probably could use OS X’s built-in Apache server, but XAMPP is portable and in order to keep things consistent from platform to platform I tend to like it better. Make sure you disable Apache by unchecking the “Web Sharing” option of the “Sharing” system preference pane.
If you browse to http://localhost you should see a XAMPP splash page. Success! Next, go back to the XAMPP website and download the devel package, this will install and tweak the settings of the basic install to give you better development tools.
Now some configuration. Other than the usual ramping up the memory and defining the available resources you will need to setup at least one Vritual Host to use Virtual Document Root
XAMPP will serve pages from
/Applications/xampp/xamppfiles/htdocs. I keep my websites on a special folder located at
/workspace (often times it's just a symlink to another folder somewhere) so we will need to make some adjustments.
The idea here is that I can create folders under
/workspace/rob and be able to get to them via
http://rob without having to edit the vhosts file.
In order to keep things clean I created a new file called
/Applications/xampp/xamppfiles/etc/extra/httpd-dynamic-vhosts.conf with the following:
$ sudo vim /Applications/xampp/xamppfiles/etc/extra/httpd-dynamic-vhosts.conf
<VirtualHost *:80> UseCanonicalName Off VirtualDocumentRoot /workspace/%0 <Directory "/workspace"> Options Indexes FollowSymLinks ExecCGI Includes AllowOverride AuthConfig Order allow,deny Allow from all </Directory> </VirtualHost>
%0 are ONLY available if you load
Next, I included the above .conf file, by adding the following line to the bottom of /Applications/xampp/xamppfiles/etc/httpd.conf:
$ sudo vim /Applications/xampp/xamppfiles/etc/httpd.conf
Now let's restart Apache and try to load http://rob. Voilá, success!