php 如何在亚马逊 linux 中安装 Php5.6

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

How to Install Php5.6 in amazon linux

phpapache

提问by avaj

I'm trying to install php 5.6 on Amazon linux using the following command:

我正在尝试使用以下命令在 Amazon linux 上安装 php 5.6:

$ yum install php56
No package php56 available.
Error: Nothing to do

Is there a repository I need to add in order to do this? I've searched for this but couldn't find any source. I'd also like to know which Apache versions work with this version of php?

是否需要添加存储库才能执行此操作?我已经搜索过这个,但找不到任何来源。我还想知道哪些 Apache 版本适用于这个版本的 php?

采纳答案by disasteraverted

AWS has not yet packaged php 5.6. You need to install php 5.5 from the ALAMI repositories, or build 5.6 from source.

AWS 尚未打包 php 5.6。您需要从 ALAMI 存储库安装 php 5.5,或从源代码构建 5.6。

To list the available 5.5 packages use yum search php55

要列出可用的 5.5 软件包,请使用 yum search php55

The php55is the base package, but you may need others listed as well.

php55是基本软件包,但您可能还需要列出其他软件包。

When 5.6 is ready, you'll be able to find it with yum search php56

当 5.6 准备好时,您将能够找到它 yum search php56

You can find information on building the source at php.net, specifically Installation on Unix Systems / Apache 2.x on Unix Systems

您可以在php.net上找到有关构建源代码的信息,特别是在 Unix 系统上的安装/Unix 系统上的 Apache 2.x

回答by Rijas Madurakuzhi

Below are the steps I have used to update PHP version from 5.3 to 5.6 in Amazon Linux

以下是我在 Amazon Linux 中将 PHP 版本从 5.3 更新到 5.6 的步骤

Steps (Use sudoonly if required)

步骤(仅在需要时使用sudo

1) Remove OLD Apache

1)删除旧的Apache

sudo service httpd stop
sudo yum erase httpd httpd-tools apr apr-util

2) Remove OLD PHP

2) 删除旧的 PHP

sudo yum remove php-*

3) Install PHP 5.6 (Apache 2.4 will be automatically installed with this)

3)安装PHP 5.6(Apache 2.4会自动安装)

sudo yum install php56

4) Make sure all the required PHP extensions are installed

4) 确保安装了所有必需的 PHP 扩展

yum list installed | grep php

5) If not then install them using

5)如果没有,则使用安装它们

sudo yum install php56-xml php56-xmlrpc php56-soap php56-gd

6) To list the other available php extensions

6) 列出其他可用的 php 扩展

yum search php56

7) PHP 5.6 MySQL extension (Assume you have already installed MySQL)

7) PHP 5.6 MySQL 扩展(假设你已经安装了 MySQL)

sudo yum install php56-mysqlnd 

(NOTE: it is not php56-mysql)

(注意:不是php56-mysql)

8) Start / Restart Apache

8) 启动/重启Apache

sudo service httpd start
sudo service httpd restart

9) Check the version

9)检查版本

php -v
httpd -v

回答by Daniele Rugginenti

Just to mantain update the answers, I tryed the proposed solution and didn't work.

只是为了保持更新答案,我尝试了建议的解决方案但没有奏效。

Quite hard to install 5.6

很难安装 5.6

I found the right command nowaday to install 7.2 is

我发现现在安装 7.2 的正确命令是

amazon-linux-extras install php7.2

it install and upgrade everything without complications.

它可以轻松安装和升级所有内容。

回答by mitul vasoya

Try this:

尝试这个:

sudo yum -y update

sudo yum install –y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

sudo wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo wget https://centos7.iuscommunity.org/ius-release.rpm

sudo rpm -Uvh ius-release*.rpm

sudo yum -y update

When you install the package you'll need to add a u to the end of php56. Here is an example of some packages you could install.

安装软件包时,您需要将 au 添加到 php56 的末尾。这是您可以安装的一些软件包的示例。

sudo yum -y install php56u php56u-opcache php56u-xml \
  php56u-mcrypt php56u-gd php56u-devel php56u-mysql \
  php56u-intl php56u-mbstring php56u-bcmath php56u-soap