Skip to content

Instantly share code, notes, and snippets.

@westonruter
Created June 7, 2011 18:04
Show Gist options
  • Save westonruter/1012774 to your computer and use it in GitHub Desktop.
Save westonruter/1012774 to your computer and use it in GitHub Desktop.
Getting PHP 5.2 and PHP 5.3 to work together on OS X XAMPP
  1. You are on OS X and have the latest XAMPP installed with PHP 5.3
  2. Download xampp-macosx-1.0.1.dmg from Sourceforge; this includes PHP 5.2.9
  3. Copy existing /Applications/XAMPP/xamppfiles/modules/libphp5.so to /Applications/XAMPP/xamppfiles/modules/libphp53.so
  4. Open the DMG and copy its xamppfiles/modules/libphp5.so to the same directory in your install's modules directory, but give it the name libphp52.so
  5. From the DMG, copy xamppfiles/lib/libming.0.3.0.dylib to your xamppfiles/lib/ directory.
  6. From the DMG, copy xamppfiles/lib/php/php-5.2.9 into your xamppfiles/lib/php/ directory to live alongside php-5.3.x
  7. From the DMG, copy the xamppfiles/bin/php*5.2.9 files to your xampp/bin/ directory, to live slongside their PHP 5.3 equivalents.
  8. Then you can switch between PHP 5.2 and PHP 5.3 by swapping out the modules/libphp5.php file and restarting Apache, as demonstrated in the included scripts.

So far, things are working for me.

#!/bin/bash
# /Applications/XAMPP/xamppfiles/modules/libphp52.so was the original libphp5.so from xampp-macosx-1.0.1.dmg on Sourceforge
sudo cp /Applications/XAMPP/xamppfiles/modules/libphp52.so /Applications/XAMPP/xamppfiles/modules/libphp5.so
sudo apachectl restart
#!/bin/bash
# /Applications/XAMPP/xamppfiles/modules/libphp53.so was the original libphp5.so in the latest XAMPP
sudo cp /Applications/XAMPP/xamppfiles/modules/libphp53.so /Applications/XAMPP/xamppfiles/modules/libphp5.so
sudo apachectl restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment