Way to Install the MongoDB PHP Driver - php

I'm trying to enable PHP for Mongo DB. Solution for that is same (install php5-dev first) in every forums but to installation fails with error.
Any idea how to solve issue?
Note: Using Ubuntu 12:04
jojo#ubuntu:~$ sudo apt-get install php-pear php5-dev
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:
php-pear : Depends: php5-cli but it is not going to be installed
php5-dev : Depends: autoconf (>= 2.63) but it is not installable
Depends: automake (>= 1.11) but it is not installable
Depends: libtool (>= 2.2) but it is not installable
Depends: shtool but it is not installable
E: Unable to correct problems, you have held broken packages.
jojo#ubuntu:~$

Assuming you have already installed MongoDB, You can install PHP driver for MongoDB by this command
sudo apt-get install php5-mongo

sudo apt-get install php5-mongo
worked on PHP 5.5.9 / Ubuntu 14.04 LTS

I would suggest to do this:
apt-get update
apt-get upgrade
And then install:
apt-get install php5-cli php5-dev
And then:
apt-get install php-pear
pecl install mongo

I created a fresh content for sources.list using this page and then installed Synaptic Package Manager to install new stuff which solved the problem..

This seems less like an issue with installing php5-dev, or even the mongo extension, and more with the following conflicts:
Depends: autoconf (>= 2.63) but it is not installable
Depends: automake (>= 1.11) but it is not installable
Depends: libtool (>= 2.2) but it is not installable
Depends: shtool but it is not installable
You can get some more information on these with sudo aptitude show <package>, which may clue you in on other installed packages that they conflict with. From personal experience, I've only had to install the build-essential package to do any C/C++ compiling on Ubuntu. That high-level package usually ends up covering these dependencies.

http://docs.mongodb.org/ecosystem/drivers/php/
This link gives all commands we need to execute for different operting system to install php driver for mongoDb

Related

How to download php7.2-gd extension in ubuntu 21.04?

I want to install gd extension in my current php-project(php version is 7.2.34) for that i use this command sudo apt-get install php7.2-gd it's throwing following error and it's not showing in the list when i run php -m command ,How to install gd extension please help me to fix this issue..
Error
Reading package lists... Done
Building dependency tree... Done
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-gd : Depends: libjpeg62-turbo (>= 1.3.1) but it is not installable
E: Unable to correct problems, you have held broken packages.
This package depends on libjpeg62-turbo so you need to install it first
wget http://ftp.debian.org/debian/pool/main/libj/libjpeg-turbo/libjpeg62-turbo_1.5.1-2_amd64.deb
sudo apt-get install ./libjpeg62-turbo_1.5.1-2_amd64.deb
after that, you could install your package easily
sudo apt-get install php7.2-gd

mbstring Ubuntu 14.04 dependency package conflict

I am trying to install PHP mbstring module in my Ubuntu 14.04 machine. I've used "sudo apt-get -f install php7.0-mbstring" to install the module. I've added necessary source list in "/etc/apt/sources.list".
When I run the above mbstring installation command I get the following error.
The following packages have unmet dependencies:
php7.0-mbstring : Depends: php7.0-common (= 7.0.33-0ubuntu0.16.04.6) but 7.0.21-1~ubuntu14.04.1+deb.sury.org+1 is to be installed
Conflicts: php7.0-mbstring:i386 but 7.0.33-0ubuntu0.16.04.6 is to be installed
php7.0-mbstring:i386 : Depends: php-common:i386 (>= 1:33) but it is not installable
Depends: php7.0-common:i386 (= 7.0.33-0ubuntu0.16.04.6) but it is not going to be installed
Depends: libc6:i386 (>= 2.4) but it is not going to be installed
Conflicts: php7.0-mbstring but 7.0.33-0ubuntu0.16.04.6 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
What is the recommended solution here? Do I need to uninstall PHP 7.0 and reinstall or is there any other low risk solution?
Edit: I've tried to install with sudo apt-get -f install as well. I get the same following error,
php7.0-mbstring:i386 : Depends: php-common:i386 (>= 1:33) but it is not installable
Depends: php7.0-common:i386 (= 7.0.33-0ubuntu0.16.04.6) but it is not installed
Depends: libc6:i386 (>= 2.4) but it is not installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
E: Unable to correct dependencies
First be sure that your package list is up to date, try:
sudo apt-get update
After it try install packeage again
sudo apt-get install php7.0-mbstring
If it doesn't help try to add php repository to source list, for example you can use this PPA
sudo apt-add-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.0-mbstring

I ran apt-get dist-upgrade and my php stop working

I have searched but couldn't find a resource that helped, so I have to say it out loud. Please help me. I mistakenly ran sudo apt-get upgrade -u dist-upgrade
After that, all the websites on my server stopped working. I tried to check if Php is still installed by typing php -vbut I got
-bash: php: command not found
I also tried to reinstall php using
sudo apt-get install php
And I saw this
sudo apt-get install php
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:
php : Depends: php7.2 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Then I tried running
Sudo apt-get install php7.2
And I saw this
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 : Depends: libapache2-mod-php7.2 but it is not going to be installed or
php7.2-fpm but it is not going to be installed or
php7.2-cgi but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
I also tried installing the modules: and I get this:
root#matrixpluspluto:~# sudo apt-get install php7.2 php7.2-cli php7.2-c
gi php7.2-fpm libapache2-mod-php7.2 php7.2-opcache
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:
libapache2-mod-php7.2 : Depends: libc6 (>= 2.27) but 2.24-11+deb9u1 is to be installed
Depends: libsodium23 (>= 1.0.14) but it is not going to be installed
php7.2-cgi : Depends: libc6 (>= 2.27) but 2.24-11+deb9u1 is to be installed
Depends: libsodium23 (>= 1.0.14) but it is not going to be installed
php7.2-cli : Depends: libc6 (>= 2.27) but 2.24-11+deb9u1 is to be installed
Depends: libsodium23 (>= 1.0.14) but it is not going to be installed
php7.2-fpm : Depends: libc6 (>= 2.27) but 2.24-11+deb9u1 is to be installed
Depends: libsodium23 (>= 1.0.14) but it is not going to be installed
php7.2-opcache : Depends: libc6 (>= 2.27) but 2.24-11+deb9u1 is to be installed
E: Unable to correct problems, you have held broken packages.
I checked and saw that libc6 v2.24 is already installed
Please help me. Before this I was using php7.1 after the upgrade I started seeing 7.2. Anything I do concerning php doesn't work out. Pove been trying to fix this for more than 2 days, please help.
Don't know if you solved it yet but I had the same problem.
Solved it by running :
sudo apt-get purge php* .
Note that this is not a good solution but a desperate one. Also I knew what php related packages I had installed, so I wasen't afraid of what the command would purge.
Then I watched what packages are being purged and reintalled them.
Everything working fine for now.

Cannot install php 7.2 on Raspbian

I cannot install php 7.2 on Raspbian.
I used the last Raspbian (Release date : 2017-11-29) with a Debian Stretch 9.1 : https://www.raspberrypi.org/downloads/raspbian/
I followed the instructions from https://www.colinodell.com/blog/2016-12/installing-php-7-1 :
apt-get install apt-transport-https lsb-release ca-certificates
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list
apt-get update
But when I try
apt-get install -y php7.2
A get the below errors :
root#raspberrypi:/home/pi# apt-get install -y php7.2
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 : Depends: libapache2-mod-php7.2 but it is not installable or
php7.2-fpm but it is not installable or
php7.2-cgi but it is not installable
Depends: php7.2-common but it is not installable
E: Unable to correct problems, you have held broken packages.
Someone can help me ?
Thanks a lot
I found the reason, the package php7.1 and php7.2 isn't in the stretch repo :(.
https://raspberrypi.stackexchange.com/questions/70388/how-to-install-php-7-1
Have to wait an update ...
Please check this GitHub issue:
https://github.com/oerdnj/deb.sury.org/issues/579
It seems that Debian packages for newer PHP versions are not yet released for the ARM architecture.
I would like to contribute for building such packages, but there is no activity on the issue after my last post.
An option to install PHP7.1 or newer would be to compile and install it yourself. For some examples, you may want to check http://yoestuve.es/blog/compile-php-7-for-raspberry-pi-with-memcached/. I would also suggest to use checkinstall instead of make install in order to facilitate easier uninstallation later.
Unfortunately it does not look like there will be a higher version than PHP 7.0 for raspberrys with stretch. Here you can see the PHP versions for current and future raspbian releases:
https://packages.debian.org/search?arch=armhf&searchon=names&keywords=php
You will have to upgrade to buster, then you will get PHP 7.3. Here is how:
https://www.raspberrypi.org/blog/buster-the-new-version-of-raspbian/

Broken PHP install? Unmet dependencies on any package

I need to enable APC on my server, however not a single package will install (even php5 says it has unmet dependencies but is installed already)
The error I am getting says it will not install the packages. I tried -f and --fix-missing to no avail
apt-get -f install php5 php5-fpm php-pear php5-common php5-mcrypt php5-mysql php5-cli php5-gd
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:
php5-cli : Depends: libdb5.1 but it is not installable
Depends: libssl1.0.0 (>= 1.0.0) but it is not installable
Depends: libxml2 (>= 2.8.0) but 2.7.8.dfsg-2+squeeze8 is to be installed
Depends: libedit2 (>= 2.11-20080614-4) but 2.11-20080614-2 is to be installed
php5-common : Depends: psmisc (>= 22.15-1~) but 22.11-1 is to be installed
php5-fpm : Depends: libdb5.1 but it is not installable
Depends: libssl1.0.0 (>= 1.0.0) but it is not installable
Depends: libxml2 (>= 2.8.0) but 2.7.8.dfsg-2+squeeze8 is to be installed
php5-gd : Depends: libjpeg8 (>= 8c) but it is not going to be installed
php5-mcrypt : Depends: libltdl7 (>= 2.4.2) but 2.2.6b-2 is to be installed
php5-mysql : Depends: libmysqlclient18 (>= 5.5.24+dfsg-1) but it is not going to be installed
E: Broken packages
“It is not installable“ means APT does not know where to get this package. You either have incompatible sources in /etc/apt or you need to update the package cache with apt-get update.

Categories