32

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

4
  • 1
    Why can't you use Joomla 1.5 with PHP 5.3?
    – Pekka
    Feb 10, 2010 at 21:11
  • 3
    I've edited the question to remove references to Joomla, since neither the questions nor answers related to it.
    – nickf
    Jun 17, 2010 at 0:15
  • 1
    @nickf - The question is related to Joomla, since Joomla versions less than 1.5.5 will trigger a ton of errors if used with PHP 5.3 - but not with PHP 5.2 - Though, I don't know if the OP had this in mind. Aug 24, 2011 at 17:08
  • 1
    It's years later - but swapping between different versions of XAMPP is simple to do; just install different versions of XAMPP and rename directories to switch between versions. Please see my answer dated 2/15/2013. Feb 15, 2013 at 14:27

8 Answers 8

24

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

6
  • 1
    Worked perfectly for me, thanks. The latest version of XAMPP without PHP 5.3 is XAMPP 1.7.1 which you can download here: oldapps.com/xampp.php?old_xampp=44
    – nickf
    Jun 17, 2010 at 0:27
  • 1
    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!
    – user484723
    Oct 22, 2010 at 22:12
  • 1
    Worked nicely, for completeness, I had to comment the line # LoadModule php5_module modules/php5apache2_2.dll (I used XAMPP 1.7.1 too) Dec 2, 2010 at 10:16
  • It's years later - but swapping between different versions of XAMPP is simple to do; just install different versions of XAMPP and rename directories to switch between versions. Please see my answer dated 2/15/2013. Feb 15, 2013 at 14:29
  • 1
    I don't know about oldapps.com, but XAMPP links to SourceForge for the old versions. I got my XAMPP here: sourceforge.net/projects/xampp/files/XAMPP%20Windows/1.7.1/….
    – Randell
    Nov 5, 2013 at 5:30
21

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.

4
  • 4
    I wish xampp would figure out this feature. Wamp is just wonderful for that.
    – WalterJ89
    Aug 6, 2010 at 8:48
  • Agree, the same goes for multiple mysql versions. Very helpfull/nice feature!
    – NickGreen
    Aug 12, 2011 at 8:53
  • 1
    For Mac Users, you want to use MAMP which does allow to install multiple version of PHP (I believe)
    – TheTechGuy
    May 7, 2014 at 5:34
  • Good to know that WAMP supports this. This is important that WordPress still supports PHP 5.2.
    – Anh Tran
    Feb 18, 2016 at 3:03
8

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

6
  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 ensues.

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).

2
  • 1
    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
    Dec 12, 2009 at 2:02
  • 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 earlier 2) copied over bin/php*-5.2.9 files and ran "share/lampp/activatephp 5.2.9"
    – CaptSolo
    Mar 15, 2010 at 20:42
3

Years later, but for what it's worth - This is simple to do.

  • Just RENAME the C:\xampp directory

  • Install the desired new version of XAMPP

  • Simply run the control panel script "xampp-control.exe" directly from within the xampp folder. (Ignore warnings about "must run from C:\xampp - those have nothing to do with multiple installations.)

To switch between these versions of XAMPP, just rename the xampp directories as necessary, and re-run.

2

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
2

I couldn't get this working. Started with PHP 5.3, then tried to switch to PHP 5.28 from xampp-win32-1.7.0.zip. Couldn't get it to work. Then, I got smart and figured out i was working with XAMPP and you can install it wherever you want, so I did a fresh install from scratch with xampp-win32-1.7.0.zip. The whole point of working with XAMPP is so you don't have to fuss with the sysadmin stuff. Using it in that context got me up and running in no time.

0

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.

Edit: On 10.4 (Tiger), Xampp 1.73, using the libphp5.so-files found at Mamp, this does not work at all.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.