No sooner did I say that I was happy with XAMPP, when suddenly it was useless and no good to me. Yes it was nice and easy to install, but heres the catch – all that goodness turns rotten when you want to upgrade a part of it.
If you’ve been reading along then you’ll know that I was in the process of preparing to install Doctrine, however, it wants at the very least, PHP 5.2, and lo and behold, along came sod and his law. XAMPP runs 5.1!
I tried swapping out the libphp5.so file with the one from the Mac’s built in Apache (5.3.10) to no avail, although someone on the internet claimed it was possible.
This left me with the choice. What now? Mamp? Zend Server Community Edition? Built in Mac Apache? The correct choice of course is the shipped with Mac Apache, as the other two are once again complete PHP stack solutions, like XAMPP, and we don’t want caught out like that again! Time to get serious and install and configure all of our server components ourselves.
It’s actually remarkably easy to move your Apache and PHP across from XAMPP. I’m guessing your htdocs are kept in the Mac’s ‘Site’ folder, like they should be. If not go into your xampp htdocs and move them across.
Next you copy your virtual host entries and put them in /etc/apache2/extra/http-vhosts.conf
Then we edit /etc/apache2/httpd.conf, uncommenting the php library module by deleting the # at the start of the line:
#LoadModule php5_module libexec/apache2/libphp5.so
LoadModule php5_module libexec/apache2/libphp5.so
In the <Directory “/Library/WebServer/Documents”>, we enable the use of .htaccess by having:
A little gotcha which had me stumped was that the .htaccess files in my sites still weren’t being used. It turns out you have a specific file for that:
sudo nano /private/etc/apache2/users/delboy1978uk.conf
Options Indexes MultiViews
Options +Indexes +FollowSymLinks +ExecCGI
Allow from all
And thats Apache sorted! We can start, stop, and restart Apache with the following commands (You can also tick a button in Apple > Preferences > Sharing > Web Sharing):
Having done that if you phpinfo(), you’ll see that there is no php.ini file! (which freaked me out a little), so I had to make one.
There I discovered that we have php.ini.default, so I made a copy and then edited it:
cp php.ini.default php.ini
In there I set the following:
error_reporting = E_ALL | E_STRICT
display_errors = On
html_errors = On
include_path = ".:/usr/lib/php:/usr/lib/php/Zend:/usr/lib/php/ZendX
Lastly need the zend libraries in their new home:
sudo cp -R /Application/XAMPP/xamppfiles/library/Zend /usr/lib/php/Zend
sudo cp -R /Application/XAMPP/xamppfiles/library/ZendX /usr/lib/php/ZendX
Part 2 and we’ll kill XAMPP once and for all, leaving us with a system which will be far more powerful and customisable, and then maybe I can get on with what I was trying to do, i.e.. program!