错误:找不到php_pdo_driver。安装时h pdo_mysql

时间:2022-09-19 14:20:12

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 ,

我想将pdo_mysql扩展加载到php,以便在VPS(运行CentOS)中安装Megento。然后我搜索PHP。ini文件,用于“extension=pdo”。所以”。但是我在ini文件中找不到这样一行。然后我尝试使用“pecl安装”安装pdo_mysql。但是通过显示这个错误,安装退出,

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.

我的phpinfo。请帮助我解决这个问题。

2 个解决方案

#1


2  

You have to build PHP with PDO support.

您必须使用PDO支持构建PHP。

http://pecl.php.net/package/PDO

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."

“不要使用这个,因为PDO已经转移到core (php源代码)中,所以这个pecl扩展已经死亡。”

#2


1  

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.

当前PHP的核心中包含PDO扩展,但是仍然需要为需要连接的每个数据库引擎添加支持。

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)

我遇到了symfony2关于缺少pdo_pgsql驱动的问题。我在网上找遍了所有地方,基本上得出的结论是我必须这么做(在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.)

但这将失败,基本上与失败的原因相同(在我的例子中,它说配置:error:找不到php_pdo_driver.h)。

then, by accident, I found out that you need to install the packages as

然后,我意外地发现您需要将包安装为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.

这将把pdo_pgsql和pdo_mysql添加到PDO驱动程序中。

In centOS, it should be

在centOS,它应该是

sudo yum install php-pgsql
sudo yum install php-mysql

#1


2  

You have to build PHP with PDO support.

您必须使用PDO支持构建PHP。

http://pecl.php.net/package/PDO

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."

“不要使用这个,因为PDO已经转移到core (php源代码)中,所以这个pecl扩展已经死亡。”

#2


1  

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.

当前PHP的核心中包含PDO扩展,但是仍然需要为需要连接的每个数据库引擎添加支持。

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)

我遇到了symfony2关于缺少pdo_pgsql驱动的问题。我在网上找遍了所有地方,基本上得出的结论是我必须这么做(在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.)

但这将失败,基本上与失败的原因相同(在我的例子中,它说配置:error:找不到php_pdo_driver.h)。

then, by accident, I found out that you need to install the packages as

然后,我意外地发现您需要将包安装为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.

这将把pdo_pgsql和pdo_mysql添加到PDO驱动程序中。

In centOS, it should be

在centOS,它应该是

sudo yum install php-pgsql
sudo yum install php-mysql