如何向MAMP添加额外的PHP版本?

时间:2022-07-18 22:47:56

The current version of MAMP that I have only has php 5.2.17 and 5.4.4. I need 5.3.X. Is there a way to add additional versions that can be selected in the MAMP interfaces php preferences? This is for the free version of MAMP, not MAMP PRO.

当前版本的MAMP我只有php 5.2.17和5.4.4。我需要5.3.X。是否有一种方法可以添加可以在MAMP接口中选择的附加版本?这是免费版的MAMP,而不是MAMP PRO。

Thanks

谢谢

6 个解决方案

#1


233  

Found a quick fix in the MAMP forums.

在MAMP论坛找到了一个快速解决方案。

Basically it seems MAMP is only allowing 2 versions of PHP to show up. Quick fix, rename the folders you're not bothered about using, for me this meant adding an "X" to my /Applications/MAMP/bin/php/php5.4.10_X folder. Now 5.2.17 and 5.3.20 show up in the mamp prefs.

基本上,MAMP似乎只允许出现两个版本的PHP。快速修复,重命名你不介意使用的文件夹,对我来说这意味着给我的/应用程序/MAMP/bin/php/php5.4.10_X文件夹添加一个“X”。现在5.2.17和5.3.20在mamp prefs中出现。

Done!

完成了!

Edit - if the PHP version you require isn't in the PHP folder, you can download the version you require from http://www.mamp.info/en/downloads/

编辑-如果你需要的PHP版本不在PHP文件夹中,你可以从http://www.mamp.info/en/downloads/下载你需要的版本。

#2


28  

If you need to be able to switch between more than two versions at a time, you can use the following to change the version of PHP manually.

如果您需要能够一次切换两个以上版本,您可以使用以下方法手动更改PHP版本。

MAMP automatically rewrites the following line in your /Applications/MAMP/conf/apache/httpd.conf file when it restarts based on the settings in preferences. You can comment out this line and add the second one to the end of your file:

MAMP在您的/应用程序/MAMP/conf/apache/httpd中自动重写以下行。根据首选项的设置重新启动时,conf文件。您可以注释掉这一行,并将第二个添加到文件的末尾:

# Comment this out just under all the modules loaded
# LoadModule php5_module        /Applications/MAMP/bin/php/php5.x.x/modules/libphp5.so

At the bottom of the httpd.conf file, you'll see where additional configurations are loaded from the extra folder. Add this to the bottom of the httpd.conf file

在httpd的底部。在conf文件中,您将看到额外的配置是从额外的文件夹中加载的。将其添加到httpd的底部。配置文件

# PHP Version Change
Include /Applications/MAMP/conf/apache/extra/httpd-php.conf

Then create a new file here: /Applications/MAMP/conf/apache/extra/httpd-php.conf

然后在这里创建一个新文件:/应用程序/MAMP/conf/apache/extra/httpd-php.conf。

# Uncomment the version of PHP you want to run with MAMP
# LoadModule php5_module /Applications/MAMP/bin/php/php5.2.17/modules/libphp5.so
# LoadModule php5_module /Applications/MAMP/bin/php/php5.3.27/modules/libphp5.so
# LoadModule php5_module /Applications/MAMP/bin/php/php5.4.19/modules/libphp5.so
LoadModule php5_module /Applications/MAMP/bin/php/php5.5.3/modules/libphp5.so

After you have this setup, just uncomment the version of PHP you want to use and restart the servers!

在您设置了这个设置之后,请取消对您想要使用的PHP版本的注释,并重新启动服务器!

#3


9  

Maybe easy like this?

也许这样简单吗?

Compiled binaries of the PHP interpreter can be found at http://www.mamp.info/en/ downloads/index.html . Drop this downloaded folder into your /Applications/MAMP/bin/php! directory. Close and re-open your MAMP PRO application. Your new PHP version should now appear in the PHP drop down menu. MAMP PRO will only support PHP versions from the downloads page.

可以在http://www.mamp.info/en/下载/索引中找到编译过的PHP解释器的二进制文件。html。将这个下载的文件夹放入你的/应用程序/MAMP/bin/php!目录中。关闭并重新打开您的MAMP PRO应用程序。您的新PHP版本现在应该出现在PHP下拉菜单中。MAMP PRO只支持从下载页面获得的PHP版本。

#4


7  

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只允许使用两个PHP版本)。“_php5.2.17”。现在,MAMP将使用剩下的php版本。转到MAMP管理器,然后设置,然后切换到需要的php版本。

One problem with this solution I encountered was the httpd process (took me a while to figure that out xD). If you have the httpd process running in the background, then the php switch won't work, until you stop those processes (sometimes MAMP has an awkward problem to stop the server, thats why this process can be still alive). Start your Activity Monitor on your Mac (Shortcut: Press Command+Space and type in activity...), go to the Search Function and type in "httpd", close all those processes. Now you should be able to switch your PHP Version with the MAMP Manager.

我遇到的这个解决方案的一个问题是httpd进程(花了我一段时间来计算出xD)。如果您在后台运行了httpd进程,那么php开关将无法工作,直到您停止这些进程(有时MAMP有一个棘手的问题来阻止服务器,这就是为什么这个过程仍然可以存活)。在你的Mac电脑上启动你的活动监视器(快捷键:按下命令+空格,然后输入Activity…),进入搜索功能,输入“httpd”,关闭所有这些进程。现在,您应该能够与MAMP管理器切换PHP版本了。

#5


3  

MAMP takes only two highest versions of the PHP in the following folder /Application/MAMP/bin/php

MAMP在以下文件夹/应用程序/MAMP/bin/ PHP中只使用了两个最高版本的PHP。

As you can see here highest versions are 7.0.10 and 5.6.25 如何向MAMP添加额外的PHP版本?

您可以看到这里的最高版本是7.0.10和5.6.25。

Now 7.0.10 version is removed and as you can see highest two versions are 5.6.25 and 5.5.38 as shown in preferences如何向MAMP添加额外的PHP版本?

现在已经删除了7.0.10版本,您可以看到最高两个版本分别是5.6.25和5.5.38。

#6


-2  

The file /Applications/MAMP/bin/mamp/mamp.conf.json holds the MAMP configuration, look for the section:

文件/应用程序/ MAMP / bin / MAMP / mamp.conf。json保存了MAMP配置,请查看该部分:

{
  "name": "PHP",
  "version": "5.6.28, 7.0.20"
}

which lists the the php versions which will be displayed in the GUI, obviously you need to have downloaded the PHP version from the MAMP site first and placed it in /Applications/MAMP/bin/php for this to work.

其中列出了将在GUI中显示的php版本,显然您需要先从MAMP站点下载php版本,然后将其放入/应用程序/MAMP/bin/php中才能运行。

#1


233  

Found a quick fix in the MAMP forums.

在MAMP论坛找到了一个快速解决方案。

Basically it seems MAMP is only allowing 2 versions of PHP to show up. Quick fix, rename the folders you're not bothered about using, for me this meant adding an "X" to my /Applications/MAMP/bin/php/php5.4.10_X folder. Now 5.2.17 and 5.3.20 show up in the mamp prefs.

基本上,MAMP似乎只允许出现两个版本的PHP。快速修复,重命名你不介意使用的文件夹,对我来说这意味着给我的/应用程序/MAMP/bin/php/php5.4.10_X文件夹添加一个“X”。现在5.2.17和5.3.20在mamp prefs中出现。

Done!

完成了!

Edit - if the PHP version you require isn't in the PHP folder, you can download the version you require from http://www.mamp.info/en/downloads/

编辑-如果你需要的PHP版本不在PHP文件夹中,你可以从http://www.mamp.info/en/downloads/下载你需要的版本。

#2


28  

If you need to be able to switch between more than two versions at a time, you can use the following to change the version of PHP manually.

如果您需要能够一次切换两个以上版本,您可以使用以下方法手动更改PHP版本。

MAMP automatically rewrites the following line in your /Applications/MAMP/conf/apache/httpd.conf file when it restarts based on the settings in preferences. You can comment out this line and add the second one to the end of your file:

MAMP在您的/应用程序/MAMP/conf/apache/httpd中自动重写以下行。根据首选项的设置重新启动时,conf文件。您可以注释掉这一行,并将第二个添加到文件的末尾:

# Comment this out just under all the modules loaded
# LoadModule php5_module        /Applications/MAMP/bin/php/php5.x.x/modules/libphp5.so

At the bottom of the httpd.conf file, you'll see where additional configurations are loaded from the extra folder. Add this to the bottom of the httpd.conf file

在httpd的底部。在conf文件中,您将看到额外的配置是从额外的文件夹中加载的。将其添加到httpd的底部。配置文件

# PHP Version Change
Include /Applications/MAMP/conf/apache/extra/httpd-php.conf

Then create a new file here: /Applications/MAMP/conf/apache/extra/httpd-php.conf

然后在这里创建一个新文件:/应用程序/MAMP/conf/apache/extra/httpd-php.conf。

# Uncomment the version of PHP you want to run with MAMP
# LoadModule php5_module /Applications/MAMP/bin/php/php5.2.17/modules/libphp5.so
# LoadModule php5_module /Applications/MAMP/bin/php/php5.3.27/modules/libphp5.so
# LoadModule php5_module /Applications/MAMP/bin/php/php5.4.19/modules/libphp5.so
LoadModule php5_module /Applications/MAMP/bin/php/php5.5.3/modules/libphp5.so

After you have this setup, just uncomment the version of PHP you want to use and restart the servers!

在您设置了这个设置之后,请取消对您想要使用的PHP版本的注释,并重新启动服务器!

#3


9  

Maybe easy like this?

也许这样简单吗?

Compiled binaries of the PHP interpreter can be found at http://www.mamp.info/en/ downloads/index.html . Drop this downloaded folder into your /Applications/MAMP/bin/php! directory. Close and re-open your MAMP PRO application. Your new PHP version should now appear in the PHP drop down menu. MAMP PRO will only support PHP versions from the downloads page.

可以在http://www.mamp.info/en/下载/索引中找到编译过的PHP解释器的二进制文件。html。将这个下载的文件夹放入你的/应用程序/MAMP/bin/php!目录中。关闭并重新打开您的MAMP PRO应用程序。您的新PHP版本现在应该出现在PHP下拉菜单中。MAMP PRO只支持从下载页面获得的PHP版本。

#4


7  

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只允许使用两个PHP版本)。“_php5.2.17”。现在,MAMP将使用剩下的php版本。转到MAMP管理器,然后设置,然后切换到需要的php版本。

One problem with this solution I encountered was the httpd process (took me a while to figure that out xD). If you have the httpd process running in the background, then the php switch won't work, until you stop those processes (sometimes MAMP has an awkward problem to stop the server, thats why this process can be still alive). Start your Activity Monitor on your Mac (Shortcut: Press Command+Space and type in activity...), go to the Search Function and type in "httpd", close all those processes. Now you should be able to switch your PHP Version with the MAMP Manager.

我遇到的这个解决方案的一个问题是httpd进程(花了我一段时间来计算出xD)。如果您在后台运行了httpd进程,那么php开关将无法工作,直到您停止这些进程(有时MAMP有一个棘手的问题来阻止服务器,这就是为什么这个过程仍然可以存活)。在你的Mac电脑上启动你的活动监视器(快捷键:按下命令+空格,然后输入Activity…),进入搜索功能,输入“httpd”,关闭所有这些进程。现在,您应该能够与MAMP管理器切换PHP版本了。

#5


3  

MAMP takes only two highest versions of the PHP in the following folder /Application/MAMP/bin/php

MAMP在以下文件夹/应用程序/MAMP/bin/ PHP中只使用了两个最高版本的PHP。

As you can see here highest versions are 7.0.10 and 5.6.25 如何向MAMP添加额外的PHP版本?

您可以看到这里的最高版本是7.0.10和5.6.25。

Now 7.0.10 version is removed and as you can see highest two versions are 5.6.25 and 5.5.38 as shown in preferences如何向MAMP添加额外的PHP版本?

现在已经删除了7.0.10版本,您可以看到最高两个版本分别是5.6.25和5.5.38。

#6


-2  

The file /Applications/MAMP/bin/mamp/mamp.conf.json holds the MAMP configuration, look for the section:

文件/应用程序/ MAMP / bin / MAMP / mamp.conf。json保存了MAMP配置,请查看该部分:

{
  "name": "PHP",
  "version": "5.6.28, 7.0.20"
}

which lists the the php versions which will be displayed in the GUI, obviously you need to have downloaded the PHP version from the MAMP site first and placed it in /Applications/MAMP/bin/php for this to work.

其中列出了将在GUI中显示的php版本,显然您需要先从MAMP站点下载php版本,然后将其放入/应用程序/MAMP/bin/php中才能运行。