使用 XAMPP,我如何将 PHP 5.3 换成 PHP 5.2?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1302168/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 01:56:51  来源:igfitidea点击:

Using XAMPP, how do i swap out PHP 5.3 for PHP 5.2?

phpxamppdowngrade

提问by jskoyles

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 - 我该怎么做?

回答by Jake

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. 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
  1. 将最新的 xampp 下载并安装到 G:\xampp。截至 2010 年 3 月 12 日,这是 1.7.3。
  2. 下载xampp-win32-1.7.0.zip的zip,这是最新的xampp发行版,不含php 5.3。提取某处,例如 G:\xampp-win32-1.7.0\
  3. 删除目录 G:\xampp\php
  4. 删除 G:\xampp\apache\modules\php5apache2_2.dll 和 php5apache2_2_filter.dll
  5. 将 G:\xampp-win32-1.7.0\xampp\php 复制到 G:\xampp\php。
  6. 复制 G:\xampp-win32-1.7.0\xampp\apache\bin\php* 到 G:\xampp\apache\bin
  7. 编辑 G:\xampp\apache\conf\extra\httpd-xampp.conf。
    • 在该行之后,<IfModule alias_module> 添加行

(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 服务器。可以通过tail G:\xampp\apache\logs\error.log文件查看启动是否有错误。如果没有,当您导航到 localhost 时,您应该能够看到 XAMPP 启动画面。

Hope this helps the next guy.

希望这对下一个人有所帮助。

cheers,

干杯,

Jake

Hyman

回答by Narcissus

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,并通过菜单选项在它们之间切换。

回答by jimyi

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。PHP 5.3 是在 1.7.2 版本中添加的,所以任何旧的东西都会很好。

回答by Daniel

  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.
  1. 停止运行 Apache 服务器。
  2. 从 apachefriends 网站上链接的 SourceForge 站点下载包含 PHP 5.2.* 版本的 XAMPP 的最新版本。
  3. 将当前安装中的 PHP 文件(MAC OSX:/xamppfiles/modules/libphp.so)重命名为其他名称(以防万一)。
  4. 从您刚刚下载的旧 XAMPP 安装中复制位于同一目录树中的 PHP 文件,并将其放置在您刚刚重命名的文件的目录中。
  5. 启动 Apache 服务器,并生成新版本的 phpinfo()。
  6. 一旦您确认 PHP 版本已降低,请从旧的 XAMPP 安装中删除剩余的文件。
  7. 乐趣随之而来。

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

我刚刚确认,当使用来自 XAMPP的 PHP 5.2.9版本用于 OS X 1.0.1(2009 年 4 月)并手术将其移动到用于 OS X 1.7.2(2009 年 8 月)的XAMPP 时,这有效。

回答by Dan Nissenbaum

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

  • 只需重命名 C:\xampp 目录

  • 安装所需的 XAMPP 新版本

  • 只需直接从 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 目录,然后重新运行。

回答by Steve

I couldn't get this working. Started with PHP 5.3, then tried to switch to PHP 5.28from 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,然后尝试切换到PHP 5.28xampp-win32-1.7.0.zip。无法让它工作。然后,我变得聪明并发现我正在使用 XAMPP 并且您可以将它安装在任何您想要的地方,所以我从头开始使用xampp-win32-1.7.0.zip. 使用 XAMPP 的全部意义在于,您不必为 sysadmin 的东西大惊小怪。在这种情况下使用它让我立即启动并运行。

回答by boxoft

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 并安装包含 PHP 5.2.8 的 XAMPP 1.7.0。

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

回答by aaronbauman

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 版本。您需要做的就是找到该版本(可能是 5.2.x)的 php 库并将其换掉。

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,使用libphp5.so-文件中找到的甲基苯丙胺,这并不在所有的工作。