I'm trying to update my php 5.5.9 to 5.6 in an Ubuntu machine.
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-1ubuntu4.20 (cli) (built: Oct 3 2016 13:00:37)
add the right ppa first, do the following
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.
This worked in my Ubuntu Server 14.04.5 LTS
This work for perfectly for me. Add the right PPA first, by doing the following
Disable php 5.5.3 or 5.5.9 module
Enable the just installed php5.6 module
Finally, you restart your apache
@tanveer ahmad dar highlighted most of it.
While the answer of @tanveerahmaddar provides crucial information, here is the correct way to install the PHP 5.6 on Ubuntu 12.04:
Step 1: Check versions
If your Apache version is 2.2, follow Step 2; if version is 2.4, skip to Step 3
Step 2: Add PHP5.6+ repository and update package list
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.
Step 3: Add PHP5.6+ Repository
Step 4: Install PHP 5.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
).Apache will be restarted during the process.
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):
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.