views:

14895

answers:

11

I'm using XAMPP 1.7.2, but need to swap out PHP 5.3 for PHP 5.2 - how do I do this?

A: 

You can download older versions of XAMPP here. PHP 5.3 was added in version 1.7.2, so anything older would be good.

jimyi
+1  A: 

You'll have to uninstall XAMPP 1.7.2 and install XAMPP 1.7.0, which contains PHP 5.2.8.

D:\Documents and Settings\box>php -v

PHP 5.2.8 (cli) (built: Dec  8 2008 19:31:23)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
    with Zend Extension Manager v1.2.0, Copyright (c) 2003-2007, by Zend Technol
ogies
    with Zend Optimizer v3.3.3, Copyright (c) 1998-2007, by Zend Technologies

XAMPP 1.6.8 contains PHP 5.2.6.

D:\Documents and Settings\box>php -v
PHP 5.2.6 (cli) (built: May  2 2008 18:02:07)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
    with Zend Extension Manager v1.2.0, Copyright (c) 2003-2007, by Zend Technol
ogies
    with Zend Optimizer v3.3.3, Copyright (c) 1998-2007, by Zend Technologies
boxoft
+3  A: 

I know this doesn't help you, but I have to say that this is one of the reasons I jumped from XAMPP to WampServer. WampServer lets you install multiple versions of PHP, Apache and/or MySQL, and switch between them all via a menu option.

Narcissus
I wish xampp would figure out this feature. Wamp is just wonderful for that.
WalterJ89
+3  A: 
  1. Stop your Apache server from running.
  2. Download the most recent version of XAMPP that contains a release of PHP 5.2.* from the SourceForge site linked at the apachefriends website.
  3. Rename the PHP file in your current installation (MAC OSX: /xamppfiles/modules/libphp.so) to something else (just in case).
  4. Copy the PHP file located in the same directory tree from the older XAMPP installation that you just downloaded, and place it in the directory of the file you just renamed.
  5. Start the Apache server, and generate a fresh version of phpinfo().
  6. Once you confirm that the PHP version has been lowered, delete the remaining files from the older XAMPP install.
  7. Fun esues.

I just confirmed that this works when using a version of PHP 5.2.9 from XAMPP for OS X 1.0.1 (April 2009), and surgically moving it to XAMPP for OS X 1.7.2 (August 2009).

Daniel
On Windows, I had to swap out the entire php directory, as well as the php relevant .dll files in the apache bin and modules folders. If you get run time errors (apache starts, but crashes when running a php script), check the lib***.dll files as well.
GApple
On Linux, I followed Daniel's instructions with some extra steps added:1) copied the whole lib/php directory (or there were some errors starting apache) as GApple commented earlier2) copied over bin/php*-5.2.9 files and ran "share/lampp/activatephp 5.2.9"
CaptSolo
A: 

I can't answers this either, however i have tried daniel's suggestion and for me then curl didn't work anymore. :-(((

halloleo
A: 

Thanks a lot Daniel :) it works like a charm !

zorex
A: 

If you use Windows, you can use WAMP instead. It lets you run multiple versions of PHP, Apache, and MySQL on the same installation. You can easily swap between versions from the UI. I used to be a XAMPP user but I switched to WAMP.

Venkat D.
+5  A: 

Thanks for the answer. I just got this working on Windows XP, with a few modifications. Here are my steps.

  1. Download and install latest xampp to G:\xampp. As of 2010/03/12, this is 1.7.3.
  2. Download the zip of xampp-win32-1.7.0.zip, which is the latest xampp distro without php 5.3. Extract somewhere, e.g. G:\xampp-win32-1.7.0\
  3. Remove directory G:\xampp\php
  4. Remove G:\xampp\apache\modules\php5apache2_2.dll and php5apache2_2_filter.dll
  5. Copy G:\xampp-win32-1.7.0\xampp\php to G:\xampp\php.
  6. Copy G:\xampp-win32-1.7.0\xampp\apache\bin\php* to G:\xampp\apache\bin
  7. Edit G:\xampp\apache\conf\extra\httpd-xampp.conf.
    • Immediately after the line, <IfModule alias_module> add the lines

(snip)

<IfModule mime_module>
  LoadModule php5_module "/xampp/apache/bin/php5apache2_2.dll"
  AddType application/x-httpd-php-source .phps
  AddType application/x-httpd-php .php .php5 .php4 .php3 .phtml .phpt
    <Directory "/xampp/htdocs/xampp">
      <IfModule php5_module>
        <Files "status.php">
            php_admin_flag safe_mode off
        </Files>
      </IfModule>
    </Directory>
</IfModule>

(Note that this is taken from the same file in the 1.7.0 xampp distribution. If you run into trouble, check that conf file and make the new one match it.)

You should then be able to start the apache server with PHP 5.2.8. You can tail the G:\xampp\apache\logs\error.log file to see whether there are any errors on startup. If not, you should be able to see the XAMPP splash screen when you navigate to localhost.

Hope this helps the next guy.

cheers,

Jake

Jake
Worked perfectly for me, thanks. The latest version of XAMPP without PHP 5.3 is XAMPP 1.7.1 which you can download here: http://www.oldapps.com/xampp.php?old_xampp=44
nickf
A: 

For OSX it's even easier. Your machine should come with a version of Apache already installed. All you need to do is locate the php lib for that version (which is likely 5.2.x) and swap it out.

This is the command you'd run from terminal*

cp /usr/libexec/apache2/libphp5.so /Applications/XAMPP/xamppfiles/modules/libphp5.so

I tested this on 10.5 (Leopard), so ymmv. * all the caveats about this might break your system, make a backup, blah blah blah.

aaronbauman
A: 

Jake's suggestion worked for me, perfectly.

I did follow Daniel's instruction to not delete the files before being sure, though. That's good strategy to follow.

Christopher Mavros
A: 

Jake's solution worked, BUT!!! Needed to change the path of the php5_module to load in http-xampp.conf: from: LoadModule php5_module modules/php5apache2_2.dll

To: LoadModule php5_module "/xampp/apache/bin/php5apache2_2.dll"

After that it worked. Cheers!

Mike