error: cannot find php_pdo_driver.h while installing pdo_mysql - php

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

Related

Installation pdo_pgsql in Ubuntu10 not working

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

Error while installing mongo driver for PHP on amazon linux

I tried to install the mongodb driver for PHP on Amazon Linux.
While running sudo pecl install mongo, I get the error message:
fatal error: openssl/evp.h: No such file or directory
#include <openssl/evp.h>
^
compilation terminated.
make: *** [io_stream.lo] Error 1
ERROR: `make' failed
PEAR Version: 1.9.5
PHP Version: 5.3.29
I installed gcc which helped me progress further with the install till this error.
The best Guide I was able to find was here:
http://jonathanhui.com/install-mongodb-amazon-linux
PHP's guide: http://php.net/manual/en/mongo.installation.php
evp is high-level cryptographic functions.
Try to install development libraries:
Ubuntu:
sudo apt-get install libssl-dev
CentOS:
yum install openssl-devel
The right package to install is not libssl-dev but
sudo apt-get install pkg-config
and now you can execute
sudo pecl install mongodb
Don't forget to add extension=mongodb.so to your php.ini file.
To know which php.ini file is loaded you can create and simple php file on vps
<?php
php_info()
?>
Example directory php.ini in phpinfo()

Installing MySQL Native Driver

I'm trying to get mysqli_result::fetch_all() to work but I'm out of my depth and butting my head against a wall. This is all being done on remote server and I'm using PuTTY to connect. The internet is telling me to install MySQL Native Driver using the following lines of code:
php ./configure --with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd
What I'm getting back is "Could not open input file: ./configure". What do I do now?
You can install the mysqlnd extension over the package manager. You should look at the documentation of your specific operation system.
But on APT systems you can use:
apt-get install php5-mysqlnd
under CentOS or better Red Hat package Manager:
yum install php-mysqlnd
when you are root you don't need the sudo command. When you are logged on as a normal user you have to write sudo before your command.
A good tutorial how to install the extension:
http://blog.ahughes.org/?p=602

Apache2 on Ubuntu 12.04: mysqlnd+mysqli and pdo_mysql - can i have both?

I have a strange error. If I install php5-mysqlnd, i can use mysqli and its functions. But i get a warning at startup in /var/apache2/error.log
If I install php5-mysql, i cannot use mysqli anymore, it won't load anymore. So i need to remove php5-mysql and invoke apt-get --reinstall install php5-mysqlnd to make mysqli work again. And I am getting this warning again.
How to fix that?
You need to use PEAR to install PHP modules. Try sudo pecl install pdo_cubrid. If pecl isn't installed - sudo apt-get install -y php-pear php5-dev. This will install PEAR and PHP 5 headers for module compilation.

Can't get to install 'intl' extension for php on debian

I have a Debian server and I want to install the intl extension through pecl.
During the installation it asks me:
"Specify where ICU libraries and headers can be found [DEFAULT] :"
Here I've been trying several options, including leaving it empty to use DEFAULT, but I get the following error:
configure: error: C++ preprocessor "/lib/cpp" fails sanity check See
'config.log' for more details. ERROR: '/tmp/pear/temp/intl/configure
--with-icu-dir=DEFAULT' failed
I've installed php5.3 with: make && make install.
I have already installed icu, but unlike php5.3, it was installed with apt-get (i don't know if this is important).
Any idea?
On Ubuntu 12.04 LTS, the following worked for me:
sudo apt-get install php5-intl
sudo /etc/init.d/apache2 restart
Bam, warning gone! Hope this helps somebody in the future :)
You need to install libicu44 and libicu-dev:
apt-get install libicu44 libicu-dev
and after this you can install intl with pecl:
./pecl install intl
Note if using Ubuntu:
It lLooks like the first package libicu44 is not available, in which case just install libicu-dev and it will go through the dependencies and handle it for you. Seems to use libicu42 at the moment.
Same error:
/tmp/pear/temp/intl/collator/collator_class.c:92: error: duplicate 'static'
But when reading the intl native extension comments, I saw:
Debian Squeeze users can install the intl extension with:
sudo apt-get install php5-intl
first comment
The package works even with my old Ubuntu 8.04...
Installing g++ sudo apt-get install g++ before sudo ./pecl install intl did the trick for me.
I knew this sounded familiar; I had the same problem back in May 2008, discussed here:
http://old.nabble.com/ubuntu-7.10-pecl-install-intl-p17140873.html
Ed Batutis explained that "/usr" is the correct answer if you have icu-config at "/usr/bin/icu-config"; adjust accordingly if it is somewhere else.
However that didn't help for me. I described the solution for me here:
http://darrendev.blogspot.com/2008/05/install-php-pecl-intl-module-for-ubuntu.html
...which was basically to define the PHP_SETUP_ICU macro. That was supposed to be added in 5.2.4, so as you are using php 5.3 your problem ought to be something else.

Categories