如何在 MAMP 4.1 上更改 PHP 版本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/43137191/
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-26 02:47:14  来源:igfitidea点击:

How to change PHP version on MAMP 4.1

phpmacosmamp

提问by calistus

I downloaded MAMP 4.1 on my Mac; by default, the only PHP versions I can use are 7.0.15 and 7.1.1

我在 Mac 上下载了 MAMP 4.1;默认情况下,我可以使用的唯一 PHP 版本是 7.0.15 和 7.1.1

How can I use PHP 5.6?

如何使用 PHP 5.6?

I tried the solution hereWhich says I should rename the versions I don't want to use to something else. But it didn't work for me.

我在这里尝试了解决方案其中说我应该将不想使用的版本重命名为其他版本。但它对我不起作用。

screenshot of MAMP preferences

MAMP 偏好的屏幕截图

回答by Armin

As mentioned by @Scott in the comments under your question:

正如@Scott 在您的问题下的评论中所提到的:

Your here is the right link. Use the bottom answer to rename the bin/php directory. The MAMP preference pane will show the 2 latest versions in the php directory. – Scott Eisenberg

你在这里是正确的链接。使用底部答案重命名 bin/php 目录。MAMP 首选项窗格将显示 php 目录中的 2 个最新版本。— 斯科特·艾森伯格

And the answer in that links is:

该链接中的答案是:

First stop the Server if its running. Go to "/Applications/MAMP/bin/", rename the PHP Version you don't need (MAMP is only allowed to use 2 PHP Versions), e.g. "_php5.2.17". Now MAMP will use the php versions that are left. Go to the MAMP Manager and then settings, then switch to the php version you need.

如果它正在运行,首先停止服务器。转到“/Applications/MAMP/bin/”,重命名不需要的 PHP 版本(MAMP 只允许使用 2 个 PHP 版本),例如“_php5.2.17”。现在 MAMP 将使用剩下的 php 版本。进入 MAMP 管理器,然后设置,然后切换到您需要的 php 版本。

In my case (and similarly yours), I renamed the folder named php7.1.1to _php7.1.1and now MAMP shows me 5.6.30and 7.0.15in the preferences pane.

在我的情况下(和你的情况类似),我将文件夹重命名php7.1.1_php7.1.1,现在 MAMP在首选项窗格中显示我5.6.307.0.15

回答by Raghava Kotekar

This is how my 'php' folder look like

这就是我的“php”文件夹的样子

Current php folder

当前php文件夹

Created another folder 'php-versions' and moved all versions, and kept only two version which I wanted in the 'php' folder. And restarted the Mamp, go the version '5.6.31'

创建了另一个文件夹“php-versions”并移动了所有版本,并在“php”文件夹中只保留了我想要的两个版本。并重新启动 Mamp,转到版本“5.6.31”

Later my 'php' folder

后来我的'php'文件夹

回答by Sakthi V

I am using MAMP version 4.5. I changed php version on the httpd.conf:

我正在使用 MAMP 4.5 版。我在 httpd.conf 上更改了 php 版本:

/Applications/MAMP/conf/apache/httpd.conf

I wanted to the version to php7.1 so here is what I did:

我想要 php7.1 的版本,所以这就是我所做的:

Original line:

原线:

LoadModule php7_module        /Applications/MAMP/bin/php/php7.2.1/modules/libphp7.so

Updated line:

更新行:

LoadModule php7_module        /Applications/MAMP/bin/php/php7.1.12/modules/libphp7.so

It worked for me!

它对我有用!