PDO和pdo_mysql已加载,但未找到类 [英] PDO and pdo_mysql loaded but class not found

查看:74
本文介绍了PDO和pdo_mysql已加载,但未找到类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚从共享主机迁移到VPS主机,因此进行了设置.我已经安装了PDO和pdo_mysql模块.显示它们已安装.我也重新启动了apache服务器.

I have just moved to a VPS hosting from a shared hosting, so setting things up. I have installed the PDO and pdo_mysql modules. It is showed they are installed. I have restarted the apache server too.

root@li339-83:~# php -m | grep -i pdo
PDO
pdo_mysql

以下是来自phpinfo.

The following is from phpinfo.

解析的其他.ini文件/etc/php5/apache2/conf.d/mysql.ini、/etc/php5/apache2/conf.d/mysqli.ini、/etc/php5/apache2/conf.d/pdo .ini,/etc/php5/apache2/conf.d/pdo_mysql.ini,/etc/php5/apache2/conf.d/suhosin.ini

Additional .ini files parsed /etc/php5/apache2/conf.d/mysql.ini, /etc/php5/apache2/conf.d/mysqli.ini, /etc/php5/apache2/conf.d/pdo.ini, /etc/php5/apache2/conf.d/pdo_mysql.ini, /etc/php5/apache2/conf.d/suhosin.ini

扩展名(如下所示)在安装后自动添加

The extensions(shown below) are added automatically after installation

extension = pdo_mysql.so; //这在pdo_mysql.ini中

extension=pdo_mysql.so; //this is in pdo_mysql.ini

extension = pdo.so; //这在pdo.ini中

extension=pdo.so; //this is in pdo.ini

但是,我无法加载我的网页.以下是错误

But, I am not able to load my webpages. The following is the error

致命错误:在第39行的/var/www/boot.php中找不到类'PDO'

Fatal error: Class 'PDO' not found in /var/www/boot.php on line 39

推荐答案

PHP.ini文件中,我们应该修改 extension_dir 指令选项.这应该指向包含 pdo.so和pdo_mysql.so 文件的目录.

In the PHP.ini file, we should modify the extension_dir directive option. This should point to the directory which contains the pdo.so and pdo_mysql.so files.

extension_dir ="/usr/lib/php5"

extension_dir = "/usr/lib/php5"

要找到这些文件所在的目录,请使用以下unix命令,

To find the directory where these files are present, use the following unix command,

找到/-name pdo.so

find / -name pdo.so

重新启动apache,问题已解决.

Restart apache and the problem is fixed.

这篇关于PDO和pdo_mysql已加载,但未找到类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆