我的 zf2 应用程序一直运行良好,但突然开始出现此错误
fatal error :第 21 行/home/doaminName/public_html/xxxxx.com/config/autoload/global.php 中未找到“PDO”类
我的 PHP 版本是 native 版本 (5.4),这是来自 phpinfo 的配置命令。 PDO 通过这一行 --enable-pdo=shared 启用。
'./configure' '--enable-bcmath' '--enable-calendar' '--enable-exif' '--enable-ftp' '--enable-gd-native-ttf' '--enable-libxml' '--enable-mbstring' '--enable-pdo=shared' '--enable-soap' '--enable-sockets' '--enable-zip' '--prefix=/usr/local' '--with-bz2' '--with-curl=/opt/curlssl/' '--with-freetype-dir=/usr' '--with-gd' '--with-gettext' '--with-imap=/opt/php_with_imap_client/' '--with-imap-ssl=/usr' '--with-jpeg-dir=/usr' '--with-kerberos' '--with-libdir=lib64' '--with-libexpat-dir=/usr' '--with-libxml-dir=/opt/xml2' '--with-libxml-dir=/opt/xml2/' '--with-mcrypt=/opt/libmcrypt/' '--with-mysql=/usr' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-mysqli=/usr/bin/mysql_config' '--with-openssl=/usr' '--with-openssl-dir=/usr' '--with-pcre-regex=/opt/pcre' '--with-pdo-mysql=shared' '--with-pdo-sqlite=shared' '--with-pic' '--with-png-dir=/usr' '--with-tidy=/opt/tidy/' '--with-xmlrpc' '--with-xpm-dir=/usr' '--with-zlib' '--with-zlib-dir=/usr'
知道问题出在哪里吗?
最佳答案
嗯,你可以尝试在global.php第21行将其设为\PDO
所有后续对 PDOException 的调用也必须进行转换。
如果它不起作用,那么你的 php 是在没有 PDO 的情况下构建的。
关于php - 未找到 ZF2 类 PDO,但在 php 配置中启用了 PDO,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32525119/