php 无法添加 PPA:'ppa:ondrej/php5-5.6'
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40567133/
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
Cannot add PPA: 'ppa:ondrej/php5-5.6'
提问by Filipe Ferminiano
I'm trying to update my php 5.5.9 to 5.6 in an Ubuntu machine.
我正在尝试在 Ubuntu 机器中将我的 php 5.5.9 更新到 5.6。
But when I run:
但是当我运行时:
sudo add-apt-repository ppa:ondrej/php5-5.6
I'm getting:
我越来越:
Cannot add PPA: 'ppa:ondrej/php5-5.6'.
Please check that the PPA name or format is correct.
How can I fix this?
我怎样才能解决这个问题?
EDIT
编辑
I ran:
我跑了:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php5
But when I run:
但是当我运行时:
php5 -v
I still get php 5.5.9:
我仍然得到 php 5.5.9:
PHP 5.5.9-1ubuntu4.20 (cli) (built: Oct 3 2016 13:00:37)
回答by tanveer ahmad dar
add the right ppa first, do the following
首先添加正确的ppa,执行以下操作
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get -y install php5.6 php5.6-mcrypt php5.6-mbstring php5.6-curl php5.6-cli php5.6-mysql php5.6-gd php5.6-intl php5.6-xsl php5.6-zip
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get -y install php5.6 php5.6-mcrypt php5.6-mbstring php5.6-curl php5.6-cli php5.6-mysql php5.6-gd php5.6-intl php5.6-xsl php5.6-zip
i had the same issue in installing the php5.6 then i did the above steps.
我在安装 php5.6 时遇到了同样的问题,然后我执行了上述步骤。
回答by Raptor
While the answer of @tanveerahmaddar provides crucial information, here is the correct way to install the PHP 5.6 on Ubuntu 12.04:
虽然@tanveerahmaddar 的回答提供了重要信息,但以下是在 Ubuntu 12.04 上安装 PHP 5.6 的正确方法:
Important: If you plan to use PHP5.6 in websites (which you probably wish to), you have to upgrade to Apache 2.4, which does not ship with Ubuntu 12.04 (will cover the upgrade of Apache below)
重要提示:如果您计划在网站中使用 PHP5.6(您可能希望如此),您必须升级到 Apache 2.4,它不随 Ubuntu 12.04 一起提供(将在下面介绍 Apache 的升级)
Step 1: Check versions
第 1 步:检查版本
# check PHP version
php -v
# check Apache version
apache2 -v
If your Apache version is 2.2, follow Step 2; if version is 2.4, skip to Step 3
如果您的 Apache 版本是 2.2,请按照第 2 步操作;如果版本是 2.4,请跳到第 3 步
Step 2: Add PHP5.6+ repository and update package list
第二步:添加PHP5.6+仓库并更新包列表
add-apt-repository ppa:ondrej/apache2
apt-get update
apt-get upgrade
This step will upgrade Apache from 2.2 to 2.4. Re-configure your Apache if needed. Backup your existing Apache configurations, enabled sites and mods. You might need to re-install / upgrade some of the mods.
这一步会将 Apache 从 2.2 升级到 2.4。如果需要,重新配置您的 Apache。备份您现有的 Apache 配置、启用的站点和 mod。您可能需要重新安装/升级某些模组。
Step 3: Add PHP5.6+ Repository
第 3 步:添加 PHP5.6+ 存储库
add-apt-repository ppa:ondrej/php
apt-get update
Step 4: Install PHP 5.6
第 4 步:安装 PHP 5.6
apt-get install -y php5.6 php5.6-mcrypt php5.6-mbstring php5.6-curl php5.6-cli php5.6-mysql php5.6-gd php5.6-intl php5.6-xsl php5.6-zip libapache2-mod-php5.6
This will install PHP 5.6 and some common packages such as cURL (php5.6-curl
) and GD (lib5.6-gd
), as well as enable PHP 5.6 in Apache 2.4 (libapache2-mod-php5.6
).
这将安装 PHP 5.6 和一些常用包,例如 cURL ( php5.6-curl
) 和 GD ( lib5.6-gd
),并在 Apache 2.4 ( libapache2-mod-php5.6
) 中启用 PHP 5.6 。
Apache will be restarted during the process.
Apache 将在此过程中重新启动。
That's all steps you have to do.
这就是您必须执行的所有步骤。
Hint: If you want to upgrade to PHP 7 instead (off-topic), just issue the following command after Step 3 (skip Step 4):
提示:如果您想升级到 PHP 7(题外话),只需在第 3 步之后发出以下命令(跳过第 4 步):
apt-get dist-upgrade
Final words: Not recommend to upgrade to PHP 5.6 in Ubuntu 12.04, as it involves upgrading Apache to 2.4. Ubuntu 14.04 comes with Apache 2.4, which is a lot easier to upgrade PHP 5.6.
最后的话:不建议在 Ubuntu 12.04 中升级到 PHP 5.6,因为它涉及将 Apache 升级到 2.4。Ubuntu 14.04 自带 Apache 2.4,升级 PHP 5.6 容易多了。
回答by nensamuel
This work for perfectly for me. Add the right PPA first, by doing the following
这项工作非常适合我。首先添加正确的 PPA,执行以下操作
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get -y install php5.6 php5.6-mcrypt php5.6-mbstring php5.6-curl
php5.6-cli php5.6-mysql php5.6-gd php5.6-intl php5.6-xsl php5.6-zip
Disable php 5.5.3 or 5.5.9 module
禁用 php 5.5.3 或 5.5.9 模块
a2dismod php5
Enable the just installed php5.6 module
启用刚刚安装的php5.6模块
a2enmod php5.6
Finally, you restart your apache
最后,你重启你的 apache
sudo service apache restart
@tanveer ahmad dar highlighted most of it.
@tanveer ahmad dar 强调了其中的大部分内容。
回答by Andrea Mezzanotte
This worked in my Ubuntu Server 14.04.5 LTS
这适用于我的 Ubuntu Server 14.04.5 LTS
a2dismod php5
a2enmod php5.6
apache2ctl restart