Upgrading php version XAMPP

Problem

Upgrading php version on XAMPP for mac.

Solution

The easiest way to upgrade PHP version is to download the XAMPP for mac (currently XAMPP comes with PHP v5.5.11) and here are the steps to go through: 1) Back up local database 2) Back up entire htdocs (or even better all xamppfiles) 3) Remove old XAMPP 4) Install the new one 5) Check php version by going here http://localhost/xampp/index.php 6) At this point if you check on terminal for PHP version (php -v) it still might give you the old version in which case you need to delete this /usr/bin/php so navigate to this dir cd /usr/bin then do a sudo rm php 7) Check php version should show the correct version. Put all the conent of htdocs in to the new installation 8) Create a virtual host form the old httpd-vhost

If you get this error

SQLSTATE[HY000]: General error: 2006 MySQL

If you are getting the above error open my.cnf through the xampp manager, make sure you click on mysql ->configure->open configuration file and change max_allowed_packet =1m to 4M.

There are two max_allowed_packet, you would need the one that starts with the following:

skip-external-locking
key_buffer = 16M
max_allowed_packet = 4M
table_open_cache = 64

To access phpmyadmin type this url http://localhost/xampp/index.php