unableto install php7 on ubuntu - php

I want to install php7 or 7.1 in Ubuntu but i can't
I try with this code :
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php7.1
and this is result :
sudo: unable to resolve host myvps
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php7.1
E: Couldn't find any package by regex 'php7.1'
Also for PHP 7.0
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php7.0
E: Couldn't find any package by regex 'php7.0'
But i know i can install php5 but i don't want !
se result of this commend php -v
root#myvps:~# php -v
The program 'php' is currently not installed. You can install it by typing:
apt-get install php5-cli
and here is my ubuntu information :
root#myvps:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 15.04
Release: 15.04
Codename: vivid
whats wrong ? is it possible to solve this problem ?

All code is correct however we need to attention to Kernel release end of life it is so important !
My problem is from here !
and for solve that we have 2 option :
first upgrade Kernel release (recommended)
second use from this hack (at your own risk)

Try without adding any repositories.
sudo apt-get install php7.0

Related

Unable to Install PHP8.0 and php8.0-pgsql on Ubuntu 21.04

I am trying to install php8.0-pgsql on my local system, but failed to install as version is not available on ubuntu release hairsuite. So for this I have remove my PHP version from my local system and try to re-install the PHP8.0 on my local system but failed to install as I have implemented different solutions like PPA and certificates but no success. Now when run following commands to install PHP8.0 to system facing following error
installation commands
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt install php8.0
sudo apt install php8.0-common php8.0-cli
Error
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package php8.0
E: Couldn't find any package by glob 'php8.0'
I don't know what is root cause of this issue as I have spent a lot of time in searching the errors but failed. Anyone suggest helpfull solution that how I can install php on my system with PHP8.0-pgsql too.
Ubuntu 21.04 has reached its end of life in January 2022, and ondrej/php does not support any EOL version. You need to upgrade your Ubuntu version first to be able to use this repository again

Can't install php7.2-ldap on Ubuntu 18.10 - "unmet dependencies"

Recently I'm working with Laravel and LDAP (Active directory) authentication. But I can't install php7.2-ldap, I also tried to install in php7.3 but failed.
Currently I'm using ubuntu v18.10 with multiple php version.
I tried:
$ sudo apt-get install php7.2-ldap
and got this output
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
php7.2-ldap : Depends: php7.2-common (= 7.2.19-0ubuntu0.18.10.1) but 7.2.20-1+ubuntu18.10.1+deb.sury.org+1 is to be installed
E: Unable to correct problems, you have held broken packages.
I also tried $ sudo apt-get update and upgrade also before do it.
7.2.20-1+ubuntu18.10.1+deb.sury.org+1 is to be installed
deb.sury.org refers to Ondřej Surý PPA, you need to reinstall php following these steps :
You need to have the software-properties-common package installed :
sudo apt-get install software-properties-common
Add the ondrej PPA repo and update sources :
sudo add-apt-repository -y ppa:ondrej/php
sudo apt-get update
Install php and needed extensions :
sudo apt-get install php7.2-common php7.2-ldap
how to : https://pixelspress.com/how-to-install-php-7-2-on-ubuntu-16-04-18-04-18-10/

How to add curl on php7.2 and ubuntu 14

I am trying to install curl on my ubunutu 14 server with php 7.2 installed. I run the following command:
sudo apt-get install php7.0-curl
but it gives error:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php7.0-curl
E: Couldn't find any package by regex 'php7.0-curl'
I then tried to resolve this issue by running commands:
sudo apt-add-repository ppa:ondrej/php
sudo apt-get update
sudo apt install apache2 libapache2-mod-php7.0 php7.0
But that also end up with same "Couldn't find package" error.
Your Ubuntu distro trusty is too old and those packages aren't available. You will have to build the library from the source by yourself.
Here you can find solution your problem How do I install the ext-curl extension with PHP 7?
Shortly, try to execute
sudo apt-get install php-curl
Also you can use sudo apt-cache search curl which shows you available packages for installation.

Not able to re-install php again on ubuntu

I want to update php version from 7.0 to 7.1 so i tried update php commands to update php version on ubuntu system.
But its not updated, so i removed php 7.0 version using purge command
sudo apt-get purge 'php*'
These are the commands i tried for update php7.1 version after uninstall php7.0
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.1 php7.1-common
Getting error in command prompt as
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php7.1
E: Couldn't find any package by glob 'php7.1'
E: Couldn't find any package by regex 'php7.1'
E: Unable to locate package php7.1-common
E: Couldn't find any package by glob 'php7.1-common'
E: Couldn't find any package by regex 'php7.1-common'
What im missing or did any thing wrong here?
It seems like php7.1 and php7.1-common packages are not available in your apt's sources.
I am assuming you are using the latest Ubuntu 18 LTS.
You could install php7.2 from the repositories, however older versions are not included anymore. You would have to install them manually.
For Version 7.2
sudo apt update
sudo apt install php7.2 php7.2-common
php -v
For Version 7.1
Download php
Extract the downloaded archive
Follow the included readme file
other options
If you are developing with different versions of PHP you might want to look into PHP docker containers
PHPDocker.io can be a good starting point.
EDIT: Also maybe consider posting this question on askubuntu instead, they might have more specific knowledge there.
You need to remove the old version before adding the new one.
Try: sudo apt-get remove php7.0*
Also it is useful to list all php packages to check if you are installing all you need.
sudo apt-get list php*
Then it is safe to run your commands.

php7.1-zip installation under Ubuntu 18.04

as the title already explains I need to install the zip module from php 7.1 under Ubuntu 18.04. When every I use the command
sudo apt-get install php7.1-zip
and the follwing output.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
php7.1-zip : Depends: libzip4 (>= 1.0) but it is not installable
E: Unable to correct problems, you have held broken packages.
Trying to Install libzip4 does not work either.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package libzip4 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'libzip4' has no installation candidate
Can somebody please try to help. Google does not help with unfortunately either.
Elias
Use the official repository:
sudo add-apt-repository universe
sudo apt update
then:
sudo apt install php7.1-zip
A temporary solution is to just download the package file from trusted source like:
https://packages.ubuntu.com/xenial/libzip4
Afterwards, install it with
dpkg -i libzip4_1.0.1-0ubuntu1_amd64.deb
And the php7.1-zip will install gracefully.
Please try with the following:
if you are using 64-bit then do:
sudo apt-get purge libzip4
then:
sudo apt-get install php7.1-zip
if you are using 32-bit system then:
sudo apt-get install php7.1-zip:i386

Categories