使用XAMPP,如何将PHP 5.3替换为PHP 5.2?

时间:2022-10-30 09:36:54

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

我正在使用XAMPP 1.7.2,但是需要将PHP 5.3替换为PHP 5.2 - 我该怎么做?

8 个解决方案

#1


24  

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

感谢你的回答。我刚刚在Windows XP上工作,只做了一些修改。这是我的步骤。

  1. Download and install latest xampp to G:\xampp. As of 2010/03/12, this is 1.7.3.
  2. 下载并安装最新的xampp到G:\ xampp。截至2010年3月12日,这是1.7.3。
  3. 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\
  4. 下载xampp-win32-1.7.0.zip的zip,这是没有php 5.3的最新xampp发行版。提取某处,例如G:\ XAMPP-win32-1.7.0 \
  5. Remove directory G:\xampp\php
  6. 删除目录G:\ xampp \ php
  7. Remove G:\xampp\apache\modules\php5apache2_2.dll and php5apache2_2_filter.dll
  8. 删除G:\ xampp \ apache \ modules \ php5apache2_2.dll和php5apache2_2_filter.dll
  9. Copy G:\xampp-win32-1.7.0\xampp\php to G:\xampp\php.
  10. 将G:\ xampp-win32-1.7.0 \ xampp \ php复制到G:\ xampp \ php。
  11. Copy G:\xampp-win32-1.7.0\xampp\apache\bin\php* to G:\xampp\apache\bin
  12. 将G:\ xampp-win32-1.7.0 \ xampp \ apache \ bin \ php *复制到G:\ xampp \ apache \ bin
  13. Edit G:\xampp\apache\conf\extra\httpd-xampp.conf.
    • Immediately after the line, <IfModule alias_module> add the lines
    • 紧接在该行之后, 添加行
  14. 编辑G:\ xampp \ apache \ conf \ extra \ httpd-xampp.conf。紧接在该行之后, 添加行

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

(请注意,这是从1.7.0 xampp发行版中的同一文件中获取的。如果遇到问题,请检查该conf文件并使其与新文件匹配。)

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.

然后,您应该能够使用PHP 5.2.8启动Apache服务器。您可以拖尾G:\ xampp \ apache \ logs \ error.log文件以查看启动时是否有任何错误。如果没有,当您导航到localhost时,您应该能够看到XAMPP启动画面。

Hope this helps the next guy.

希望这有助于下一个人。

cheers,

干杯,

Jake

可靠的人

#2


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.

我知道这对你没有帮助,但我不得不说这是我从XAMPP跳到WampServer的原因之一。 WampServer允许您安装PHP,Apache和/或MySQL的多个版本,并通过菜单选项在它们之间切换。

#3


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.

您可以在此处下载旧版本的XAMPP。在版本1.7.2中添加了PHP 5.3,所以任何旧版本都会很好。

#4


6  

  1. Stop your Apache server from running.
  2. 停止运行Apache服务器。
  3. Download the most recent version of XAMPP that contains a release of PHP 5.2.* from the SourceForge site linked at the apachefriends website.
  4. 从apachefriends网站链接的SourceForge站点下载最新版本的XAMPP,其中包含PHP 5.2。*版本。
  5. Rename the PHP file in your current installation (MAC OSX: /xamppfiles/modules/libphp.so) to something else (just in case).
  6. 将当前安装中的PHP文件(MAC OSX:/xamppfiles/modules/libphp.so)重命名为其他内容(以防万一)。
  7. 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.
  8. 从刚刚下载的旧XAMPP安装中复制位于同一目录树中的PHP文件,并将其放在刚刚重命名的文件的目录中。
  9. Start the Apache server, and generate a fresh version of phpinfo().
  10. 启动Apache服务器,并生成新版本的phpinfo()。
  11. Once you confirm that the PHP version has been lowered, delete the remaining files from the older XAMPP install.
  12. 确认PHP版本已降低后,从旧的XAMPP安装中删除剩余的文件。
  13. Fun ensues.
  14. 随之而来的乐趣。

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

我刚刚确认这在使用XAMPP for OS X 1。0。1版(2009年4月)的PHP 5.2.9版本时可行,并且通过手术将其移至XAMPP for OS X 1。7。2(2009年8月)。

#5


3  

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

多年以后,但它的价值 - 这很简单。

  • Just RENAME the C:\xampp directory

    只需重命名C:\ xampp目录

  • Install the desired new version of XAMPP

    安装所需的新版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.)

    只需直接从xampp文件夹中运行控制面板脚本“xampp-control.exe”即可。 (忽略有关“必须从C:\ xampp运行的警告 - 这些与多个安装无关。”

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

要在这些版本的XAMPP之间切换,只需根据需要重命名xampp目录,然后重新运行。

#6


2  

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

您必须卸载XAMPP 1.7.2并安装XAMPP 1.7.0,其中包含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.

XAMPP 1.6.8包含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

#7


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.

我无法让这个工作。从PHP 5.3开始,然后尝试从xampp-win32-1.7.0.zip切换到PHP 5.28。无法让它工作。然后,我变得很聪明,并且发现我正在使用XAMPP并且您可以在任何地方安装它,所以我从头开始使用xampp-win32-1.7.0.zip进行全新安装。使用XAMPP的全部意义在于您不必对sysadmin的东西大惊小怪。在这种情况下使用它让我立刻开始运行。

#8


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.

对于OSX来说,它更容易。您的计算机应该已经安装了一个Apache版本。您需要做的就是找到该版本的php lib(可能是5.2.x)并将其交换出来。

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.

我在10.5(Leopard)上测试了这个,所以ymmv。 *关于这一点的所有警告可能会打破你的系统,做一个备份,等等等等等等。

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

编辑:在10.4(Tiger),Xampp 1.73,使用在Mamp找到的libphp5.so文件,这根本不起作用。

#1


24  

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

感谢你的回答。我刚刚在Windows XP上工作,只做了一些修改。这是我的步骤。

  1. Download and install latest xampp to G:\xampp. As of 2010/03/12, this is 1.7.3.
  2. 下载并安装最新的xampp到G:\ xampp。截至2010年3月12日,这是1.7.3。
  3. 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\
  4. 下载xampp-win32-1.7.0.zip的zip,这是没有php 5.3的最新xampp发行版。提取某处,例如G:\ XAMPP-win32-1.7.0 \
  5. Remove directory G:\xampp\php
  6. 删除目录G:\ xampp \ php
  7. Remove G:\xampp\apache\modules\php5apache2_2.dll and php5apache2_2_filter.dll
  8. 删除G:\ xampp \ apache \ modules \ php5apache2_2.dll和php5apache2_2_filter.dll
  9. Copy G:\xampp-win32-1.7.0\xampp\php to G:\xampp\php.
  10. 将G:\ xampp-win32-1.7.0 \ xampp \ php复制到G:\ xampp \ php。
  11. Copy G:\xampp-win32-1.7.0\xampp\apache\bin\php* to G:\xampp\apache\bin
  12. 将G:\ xampp-win32-1.7.0 \ xampp \ apache \ bin \ php *复制到G:\ xampp \ apache \ bin
  13. Edit G:\xampp\apache\conf\extra\httpd-xampp.conf.
    • Immediately after the line, <IfModule alias_module> add the lines
    • 紧接在该行之后, 添加行
  14. 编辑G:\ xampp \ apache \ conf \ extra \ httpd-xampp.conf。紧接在该行之后, 添加行

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

(请注意,这是从1.7.0 xampp发行版中的同一文件中获取的。如果遇到问题,请检查该conf文件并使其与新文件匹配。)

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.

然后,您应该能够使用PHP 5.2.8启动Apache服务器。您可以拖尾G:\ xampp \ apache \ logs \ error.log文件以查看启动时是否有任何错误。如果没有,当您导航到localhost时,您应该能够看到XAMPP启动画面。

Hope this helps the next guy.

希望这有助于下一个人。

cheers,

干杯,

Jake

可靠的人

#2


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.

我知道这对你没有帮助,但我不得不说这是我从XAMPP跳到WampServer的原因之一。 WampServer允许您安装PHP,Apache和/或MySQL的多个版本,并通过菜单选项在它们之间切换。

#3


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.

您可以在此处下载旧版本的XAMPP。在版本1.7.2中添加了PHP 5.3,所以任何旧版本都会很好。

#4


6  

  1. Stop your Apache server from running.
  2. 停止运行Apache服务器。
  3. Download the most recent version of XAMPP that contains a release of PHP 5.2.* from the SourceForge site linked at the apachefriends website.
  4. 从apachefriends网站链接的SourceForge站点下载最新版本的XAMPP,其中包含PHP 5.2。*版本。
  5. Rename the PHP file in your current installation (MAC OSX: /xamppfiles/modules/libphp.so) to something else (just in case).
  6. 将当前安装中的PHP文件(MAC OSX:/xamppfiles/modules/libphp.so)重命名为其他内容(以防万一)。
  7. 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.
  8. 从刚刚下载的旧XAMPP安装中复制位于同一目录树中的PHP文件,并将其放在刚刚重命名的文件的目录中。
  9. Start the Apache server, and generate a fresh version of phpinfo().
  10. 启动Apache服务器,并生成新版本的phpinfo()。
  11. Once you confirm that the PHP version has been lowered, delete the remaining files from the older XAMPP install.
  12. 确认PHP版本已降低后,从旧的XAMPP安装中删除剩余的文件。
  13. Fun ensues.
  14. 随之而来的乐趣。

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

我刚刚确认这在使用XAMPP for OS X 1。0。1版(2009年4月)的PHP 5.2.9版本时可行,并且通过手术将其移至XAMPP for OS X 1。7。2(2009年8月)。

#5


3  

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

多年以后,但它的价值 - 这很简单。

  • Just RENAME the C:\xampp directory

    只需重命名C:\ xampp目录

  • Install the desired new version of XAMPP

    安装所需的新版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.)

    只需直接从xampp文件夹中运行控制面板脚本“xampp-control.exe”即可。 (忽略有关“必须从C:\ xampp运行的警告 - 这些与多个安装无关。”

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

要在这些版本的XAMPP之间切换,只需根据需要重命名xampp目录,然后重新运行。

#6


2  

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

您必须卸载XAMPP 1.7.2并安装XAMPP 1.7.0,其中包含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.

XAMPP 1.6.8包含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

#7


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.

我无法让这个工作。从PHP 5.3开始,然后尝试从xampp-win32-1.7.0.zip切换到PHP 5.28。无法让它工作。然后,我变得很聪明,并且发现我正在使用XAMPP并且您可以在任何地方安装它,所以我从头开始使用xampp-win32-1.7.0.zip进行全新安装。使用XAMPP的全部意义在于您不必对sysadmin的东西大惊小怪。在这种情况下使用它让我立刻开始运行。

#8


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.

对于OSX来说,它更容易。您的计算机应该已经安装了一个Apache版本。您需要做的就是找到该版本的php lib(可能是5.2.x)并将其交换出来。

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.

我在10.5(Leopard)上测试了这个,所以ymmv。 *关于这一点的所有警告可能会打破你的系统,做一个备份,等等等等等等。

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

编辑:在10.4(Tiger),Xampp 1.73,使用在Mamp找到的libphp5.so文件,这根本不起作用。