title: Connect mysql with pdo_mysql , Run success in windows, but fail in CentOS 5.8
body: <p>I have two computers, one install windows 7 , another is CentOS 5.8</p>
  
  <hr>
  
  <p>In CentOS...</p>
  
  <p>I use yum command to install httpd(apache2.2), php5.3.3 and mysql.</p>
  
  <ul>
  <li>yum install httpd<br></li>
  <li>yum install php53<br></li>
  <li>yum install pdo<br></li>
  <li>yum install php53-mysql<br></li>
  </ul>
  
  <p>First I check the phpinfo, the pdo, pdo_mysql is success extends,</p>
  
  <p>then I also check php -m in CentOS Terminal , have extend pdo and pdo_mysql, too.</p>
  
  <p><img src="https://i.stack.imgur.com/ZNPhd.png" alt="enter image description here">
  <img src="https://i.stack.imgur.com/TL9YP.png" alt="enter image description here"></p>
  
  <hr>
  
  <p>I run same code between windows 7 and CentOS</p>
  
  <p>window success, but centos fail</p>
  
  <p>Two files, db.php and dbtest.php</p>
  
  <p>Here is db.php:</p>
  
  <pre><code>&lt;?php
  
      class DB
      {
          private $conn;
  
          #### construct ####
          public function __construct( $dsn , $db_user , $db_password , $showError = false )
          {                       
              try
              {               
                  $this-&gt;conn = new PDO( $dsn , $db_user , $db_password );
  
                  if( $showError ) // set error information show or not. 
                  {
                      $this-&gt;conn-&gt;setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
                  }
                  else
                  {
                      $this-&gt;conn-&gt;setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT );
                  }
  
                  $setUtf8 = $this-&gt;conn-&gt;prepare( 'set names utf8' ); // set encoded by utf8
                  $setUtf8-&gt;execute();
              }
              catch( PDOException $err )
              {
                  return false;
              }
          }
      }
  ?&gt;
  </code></pre>
  
  <p>and here is dbtest.php:</p>
  
  <pre><code>&lt;?php
  
      require_once( "db.php" );
  
      $link_test = new DB( "mysql:dbname=pdotest;port=3306;host=192.168.1.127", "root" , "123456" );  
  
      var_dump($link_test);
  ?&gt;
  </code></pre>
  
  <p>When dump in windows , the result is:</p>
  
  <pre><code>object(DB)#1 (1) { ["conn":"DB":private]=&gt; object(PDO)#2 (0), { } }
  </code></pre>
  
  <p>dump in CentOS, the result is:</p>
  
  <pre><code>object(DB)#1 (1) { ["conn":"DB":private]=&gt; NULL }
  </code></pre>
  
  <p>Can anyone tell me why connect fail in CentOS??</p>
  
  <hr>
  
  <p>Edit at 2012/10/24 16:10 (Asia/Taipei)</p>
  
  <p>For test many hour, I guess is php pdo have problem...</p>
  
  <p>because in my LAN,  I can connect any 3306 port mysql by CentOS Terminal</p>
  
  <p>but in php pdo_mysql class, I can't link any mysql(even CentOS local's mysql )</p>
  
  <p>so...how to check my pdo_mysql extension is operate normally?</p>
  
  <p>PS: Sorry,I have poor English :(</p>