如何在 MAC OS X 10.7 Lion 上安装多个 XAMPP 版本或多个 PHP 版本 [英] How to install multiple XAMPP versions OR Multiple PHP versions on MAC OS X 10.7 Lion

查看:13
本文介绍了如何在 MAC OS X 10.7 Lion 上安装多个 XAMPP 版本或多个 PHP 版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在需要 PHP 5.2 的遗留系统上做一些工作

I need to do some work on a legacy system that requires PHP 5.2

我已经安装了 XAMP 1.7.3,但是这个版本有 PHP 5.3.

I already have XAMP 1.7.3 installed but this version has PHP 5.3.

因为这项工作我可能会在接下来的几个月里做几次,所以我正在考虑安装一个运行 PHP 5.2 的 XAMP 版本同时我参与了一些需要我使用 PHP 5.3 的工作,所以我无法卸载我当前的 XAMP 版本并安装一个使用 PHP 5.2 的版本

Since this a work I might do for a couple of times in the next months, I was thinking about installing a XAMP version that runs PHP 5.2 At the same time I'm involved into some work that requires me to use PHP 5.3, so I just can`t uninstall my current XAMP version and install one that uses PHP 5.2

XAMPP 下载网站上很清楚在安装任何 XAMPP 版本时,它将删除以前的版本.我做了一些研究,但找不到解决这个问题的方法.

On XAMPP Download Website it's pretty clear that on installing any XAMPP version it will remove previous one. I've done some research but couldn't find a way to get around this.

我设法在/Applications/XAMPP/xamppfiles/bin/下找到了 phpswitch,并使用它的列表操作显示我只安装了 PHP 5.3.1 并处于活动状态.我试图弄清楚如何使用 phpswitch 下载/安装/激活 PHP 5.2,但没有成功.

I managed to find phpswitch under /Applications/XAMPP/xamppfiles/bin/ and using it's list action showed me that I only have PHP 5.3.1 installed and active. I tried to figured out on how to download/install/activate PHP 5.2 using phpswitch but had no success.

所以我正在寻找一种安装多个 XAMPP 或安装 PHP 5.2 并为 XAMPP 激活它的方法(通过 phpswitch 或其他方式)

So what I'm looking for is a way to install multiple XAMPP or installing PHP 5.2 and activating it for XAMPP (either through phpswitch or another way)

推荐答案

您可以安装 XAMPP 的并行版本 - 每个主要版本的 PHP 一个.只是不要同时运行两者.

You can install parallel versions of XAMPP - one for each major version of PHP. Just don't run both at the same time.

在其自己的文件夹中安装每个 XAMPP 实例.

Install each instance of XAMPP in it's own folder.

我在一个名为

XAMPPInstalls/XAMPP182-PHP54/XAMPP183-PHP55/

在每个 XAMPP 文件夹中,您都会找到一个 .exe 文件来启动该特定 XAMPP 堆栈的控制器.我已经为它们创建了快捷方式,将它们重命名为XAMPP182-ControlPanel"和XAMPP183-ControlPanel",并将它们放在我的桌面上.

In each XAMPP folder, you'll find an .exe to launch the controller for that specific XAMPP stack. I've created shortcuts to those, renamed them to 'XAMPP182-ControlPanel' and 'XAMPP183-ControlPanel' and placed those on my desktop.

当我需要在 PHP5.4 上运行本地站点时,我单击 XAMPP182-ControlPanel 并启动 Apache 和 MySQL 服务器.

When I need to run local site on PHP5.4, I click on XAMPP182-ControlPanel and fire up the Apache and MySQL servers.

当我需要将本地站点切换到 PHP5.5 时,我单击 XAMPP182-ControlPanel 并关闭 Apache 和 MySQL 服务器,然后单击 XAMPP182-ControlPanel 并启动该堆栈中的 Apache 和 MySQL 服务器.

When I need to switch a local site to PHP5.5, I click on XAMPP182-ControlPanel and shut down the Apache and MySQL servers, then I click XAMPP182-ControlPanel and fire up the Apache and MySQL servers in that stack.

这只需几秒钟.

另外,我使用软链接",以便在一个文件夹中为本地网站进行所有配置 - 然后创建一个连接"(即,在每个 XAMPP 堆栈的 Apache 配置中复制自身的源文件夹).

Also, I use 'soft-linking' so that I do all my configuration for my local web sites in one folder - then create a 'junction' (i.e. a source folder that replicates itself in the Apache configs for each XAMPP stack).

有一篇非常好的文章叫做实用开发 2:工作环境' 作者 Marco Dings 在 Joomla!社区杂志,介绍如何设置您的工作环境以运行多个本地 XAMPP 安装、使用基于名称的托管"的多个本地网站,以及如何保持一切井井有条.

There is a really good article on this called 'Practical Development 2: Working Environment' by Marco Dings in the Joomla! Community Magazine on how to set up your work environment to run multiple local XAMPP installs, multiple local web sites using 'name based hosting,' and how to keep it all organized.

我没有完全使用 Ding 的设置 - 我进行了调整以使我的本地 Web 项目更有条理和精简 - 但我的设置基于 Ding 的方法.

I don't use Ding's set-up exactly - I've tweaked to get my local web projects even more organized and streamlined - but my set-up is based on Ding's approach.

注意:文章在 Joomla!Community Magazine 并非专门针对 Joomla!,因此您可以将此设置用于您正在从事的任何 PHP/Apache/MySQL 项目.

NOTE: The article, while in the Joomla! Community Magazine, is not specific to Joomla!, so you can use this set-up for whatever PHP/Apache/MySQL projects you are working on.

现在有很多方法可以做到这一点(例如,使用 Oracle 的 VM Virtual Box),但除非您需要完全"复制远程托管环境,否则这可能有点矫枉过正.例如,如果您正在运行专用主机"并希望密切复制专用主机的环境并尽可能接近地进行设置,那么您将使用 VM Virtual Box Set-Up - 这允许您运行多个 VM(即不同的设置),然后将确切的设置克隆到您的实时服务器.同样,如果您的大多数项目都将使用共享托管"环境,那么您对设置没有太多控制权.

Now there are lots of ways to do this (e.g. using Oracle's VM Virtual Box), but that might be overkill unless you need to replicate your remote hosting environment 'exactly.' For example, if you are running a 'dedicated host' and want to closely replicate dedicated host's environment and set up as closely as possible, then you'd go with VM Virtual Box Set-Up - this allows you to run multiple VM's (i.e. different set-ups) and then clone the exact set-up to your live server. Again, overkill if most of your projects are going to 'shared hosting' environments as you don't have much control over the set-up anyways.

XAMPP 多个实例的并行安装要简单得多,您可以按照 Ding 的文章进行设置.它应该满足您的要求.

Parallel installation of multiple instance of XAMPP is much much much simpler and you can set it up as per Ding's article. It should cover your requirements.

我提到了 Oracle VM VirtualBox,因为您至少应该知道它是一个选项.

I've mentioned Oracle VM VirtualBox because you should at least know about it as an option.

这篇关于如何在 MAC OS X 10.7 Lion 上安装多个 XAMPP 版本或多个 PHP 版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆