doucitan2544 2012-07-18 04:34
浏览 36
已采纳

升级到php 5.3.x后,PDO类未发现致命错误

We had a server upgrade where we moved form 5.2.x to php 5.3.x. I was mysql pdo with the code showen below which was working before the upgrade.

    <?php

error_reporting(E_ALL);
ini_set('display_errors', '1');


/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Database user / pass
 */
$sql_details = array(
    "user" => "",
    "pass" => "",
    "host" => "",
    "db" => ""
);


// This is included for the development and deploy environment used on the DataTables
// server. You can delete this block - it just includes my own user/pass without making 
// them public!
if ( is_file($_SERVER['DOCUMENT_ROOT']."/datatables/pdo.php") ) {
    include( $_SERVER['DOCUMENT_ROOT']."/datatables/pdo.php" );
}
// /End development include


/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Database connection
 */

/* PDO connection */
$db = new PDO(
    "mysql:host={$sql_details['host']};dbname={$sql_details['db']}",
    $sql_details['user'],
    $sql_details['pass'],
    array(
        PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
    )
);

/* mysql_* connection */
/*
if ( ! $db = mysql_pconnect( $sql_details['host'], $sql_details['user'], $sql_details['pass'] ) ) {
    header( $_SERVER['SERVER_PROTOCOL'] .' 500 Internal Server Error' );
    die( 'Could not open connection to server' );
}

if ( ! mysql_select_db( $sql_details['db'], $db ) ) {
    header( $_SERVER['SERVER_PROTOCOL'] .' 500 Internal Server Error' );
    die( 'Could not select database' );
}
*/

But after the upgrade, i get a fatal error that PDO class not found. I check ht php.ini and pdo is enabled. Below is the snippet from php.ini.

'--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-sqlite=shared' '--with-xpm-dir=/usr' '--with-zlib' '--with-zlib-dir=/usr'
pdo_mysql
pdo_mysql.default_socket => /var/lib/mysql/mysql.sock => /var/lib/mysql/mysql.sock
pdo_sqlite

Could you please help me with whats the problem here?

Thanks in advance, Srini.

  • 写回答

1条回答 默认 最新

  • douzachan4578 2012-07-18 06:50
    关注

    your phpinfo table not showing PDO section and pdo_mysql section that means you have not installed pdo.Like my phpinfo showing..see image phpinfo

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥170 如图所示配置eNSP
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥15 键盘指令混乱情况下的启动盘系统重装