Installation pdo_pgsql in Ubuntu10 not working - php

Am trying to install pdo_pgsql in ubuntu 10.04 and PHP 5.4.37. Actually the postgresql is installed and working properly with phppgadmin.
Now the problem is the pdo driver for pgsql is missing.
I installed pdo for pgsql, when I enter pecl install pdo_pgsql
# sudo pecl install pdo_pgsql
`pecl/pdo_pgsql is already installed and is the same as the released version 1.0.2
And also added a new pgsql.ini file in /etc/php5/apache2/conf.d/ as
extension=pdo_pgsql
when I run phpinfo()
I can able to see
/etc/php5/apache2/conf.d/pgsql.ini,
in Additional .ini files parsed
But I can't able to see the drivers loaded in PDO, only mysql and sqlite have been loaded.
Additional Message I got from server,
PHP Warning: PHP Startup: pdo_pgsql: Unable to initialize module
Module compiled with module API=20090626
PHP compiled with module API=20100525
These options need to match
in Unknown on line 0
FYI,
Even I tried
# sudo apt-get install php5-pgsql
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-pgsql: Depends: phpapi-20090626
Depends: php5-common (= 5.3.2-1ubuntu4.30) but 5.4.37-1+deb.sury.org~lucid+1 is to be installed
E: Broken packages
Please suggest me how to proceed further.
I even restarted the apache and server itself.
Thanks

apt-get install php5-pgsql
Try this
-----------------------------------------REMOVE
sudo apt-get purge php5-pgsql
Use this to remove pgsql
Depend what php try with php5-pgsql php-pgsql php4-pgsql

Related

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.2 missing intl extension

I'm trying to run php app that use locale_accept_from_http function from intl extension. My php version is 7.2 and I get an error: Call to undefined function locale_accept_from_http();
I was trying:
1. Install extension sudo apt-get install php-intl.
The error is:
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-intl : Depends: php7.1-intl but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
2. Enable intl extension in php.ini.
I'm getting a warning:
PHP Warning: PHP Startup: Unable to load dynamic library 'intl'
What is the right way to use this extension with php7.2?
As it states in your error, you are having broken packages so in that case, you should try to fix it, probably following commands will fix them.
apt update
apt autoremove
Once you have fixed that issue, you can try executing following commands if you have not added ondrej PPA:
add-apt-repository -y ppa:ondrej/php
apt install php7.2 php7.2-intl

Can't install again php5.6-curl on ubuntu 16.10. ppa is added.

Im trying to install php5.6-curl package. It was installed before but I did some stuff with manual build of curl, so I had remove php5.6-curl package from system. I also ran apt autoremove after this operation.
So, after successfull build stuff I was trying to call apt-get install php5.6-curl and it showed me this.
dirst#dirst-machine:~$ sudo apt-get install php5.6-curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package php5.6-curl 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 'php5.6-curl' has no installation candidate
You can be sure that ppa:ondrej/php5-5.6 is installed on my ubuntu as php5.6 is present in the system and php5.6-curl package had been isntalled before.
I also tried to add ppa again and ran apt-get update. Im not sure what this messages means.
http://ppa.launchpad.net/ondrej/php/ubuntu yakkety InRelease
.....
Fetched 107 kB in 3s (31.9 kB/s)
Reading package lists... Done
W: The repository 'http://ppa.launchpad.net/shutter/ppa/ubuntu yakkety Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: https://repo.skype.com/deb stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 1F3045A5DF7587C3
W: The repository 'https://repo.skype.com/deb stable InRelease' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: https://linuxdesktopcloud.mail.ru/screenshoter/deb/dists/appind/InRelease: Signature by key 8A99BA500079839DF7DE4833196205AF7396FF77 uses weak digest algorithm (SHA1)
E: Failed to fetch http://ppa.launchpad.net/shutter/ppa/ubuntu/dists/yakkety/main/binary-amd64/Packages 404 Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
Next what I tried is to check php extensions available with apt-cache search php5.6. There is no php5.6-curl but I know it should be there.
dirst#dirst-machine:~$ apt-cache search php5.6
php-igbinary - igbinary PHP serializer
php-msgpack - PHP extension for interfacing with MessagePack
php-ssh2 - Bindings for the libssh2 library
php-xdebug - Xdebug Module for PHP
php5.6-opcache - Zend OpCache module for PHP
php5.6-mysql - MySQL module for PHP
php5.6-json - JSON module for PHP
php5.6-common - documentation, examples and common module for PHP
php5.6 - server-side, HTML-embedded scripting language (metapackage)
php5.6-mcrypt - libmcrypt module for PHP
php5.6-readline - readline module for PHP
php5.6-gd - GD module for PHP
php5.6-xml - DOM, SimpleXML, WDDX, XML, and XSL module for PHP
php5.6-cli - command-line interpreter for the PHP scripting language
php5.6-mbstring - MBSTRING module for PHP
php5.6-ldap - LDAP module for PHP
libapache2-mod-php5.6 - server-side, HTML-embedded scripting language (Apache 2 module)
php-memcached - memcached extension module for PHP, uses libmemcached
I also launched clean ubuntu 16.04 in the cloud and tried to do same actions.
- Install php5.6, php5.6-curl.
- Remove curl and then build it manually
- Install php5.6-curl again
All worked like a charm. And list of the extensions is way too bigger when I execute apt-cache search php5.6 on cloud ubuntu.
I dont't know what am I doing wrong, Im not really strong linux guys, so I have no Idea what is going on. Please help.
guys from askubuntu helped. Thing was obvious. Just change ppa repo to xenial from yakkety and it works. As yakkety doesn't have php5.6-curl in repo.

why enabling pdo drivers did not works in php.ini file

I have a problem saying pdo exception. could not find driver I tried un- commenting and adding drivers/libraries in php.ini file. Still the error is same. below are a few lines of my php.ini file.
I even tried installing pdo drivers with the following command.
sudo apt-get install php5-mysql then i got another list of errors. the error is also posted below. Seriously out of clue. Please help me here
I have my laravel5 on port 8000 (i run the app by localhost:8000)
and phpmyadmin is operated on localhost:8080
;extension=php_openssl.dll
;extension=php_pdo_firebird.dll
extension=php_pdo_mysql.dll
extension=pdo.so
extension=pdo_mysql.so
;extension=php_pdo_oci.dll
;extension=php_pdo_odbc.dll
usman#usman-cs:~/lampstack-5.5.26-0/php$ sudo apt-get install php5-mysql
[sudo] password for usman:
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-mysql : Depends: libmysqlclient18 (>= 5.5.24+dfsg-1) but it is not going to be installed
Depends: php5-common (= 5.5.9+dfsg-1ubuntu4) but 5.5.9+dfsg-1ubuntu4.13 is to be installed
E: Unable to correct problems, you have held broken packages.

error: cannot find php_pdo_driver.h while installing pdo_mysql

I want to load pdo_mysql extension to php inorder to install Megento in my VPS (runs CentOS).
Then I searched the PHP.ini file for something like "extension=pdo.so ". But I was unable to find such a line in my ini file. Then I tried to install pdo_mysql using "pecl install" . But the installation exits by displaying this error ,
checking for PDO includes... checking for PDO includes...
configure: error: Cannot find php_pdo_driver.h.
ERROR: `/root/tmp/pear/PDO_MYSQL/configure' failed
My phpinfo . Please help me to solve this problem.
You have to build PHP with PDO support.
http://pecl.php.net/package/PDO
"Do not use this, as PDO has been moved into core (the php source) so this pecl extension is dead."
Current PHP comes with PDO extension in its core, but you still need to add support for each database engine you need to connect to.
I had this problem with symfony2 complaning about the lack of pdo_pgsql driver. I looked everywhere on the web and basically concluded that I had to do (in ubuntu)
sudo apt-get install libpq-dev
sudo pecl install pdo_pgsql
But that will fail, basically for the same reason as it failed you (in my case it said configure: error: Cannot find php_pdo_driver.h.)
then, by accident, I found out that you need to install the packages as
sudo apt-get install php5-pgsql
sudo apt-get install php5-mysql
and that will add pdo_pgsql and pdo_mysql to your PDO driver.
In centOS, it should be
sudo yum install php-pgsql
sudo yum install php-mysql

Categories