2014-01-06 16 views
11

こんにちは、私はあなたの助けキャッチされない例外「PDOException」「は、ドライバを見つけることができませんでした」

を必要とするすべての私は118.139.182.107/~rails/HTML/testを使用していますエラー

Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in /home/rails/public_html/newidenty/server.php:12 Stack trace: 
#0 /home/rails/public_html/newidenty/server.php(12): PDO->__construct('mysql:dbname=ra...', 'rails_identy', 'rails_identy') 
#1 /home/rails/public_html/newidenty/registration.php(2): include('/home/rails/pub...') 
#2 {main} thrown in /home/rails/public_html/newidenty/server.php on line 12. 

を得ました。 php PHPのバージョン のすべてのInfromationを持っていて、PDOライブラリも表示しています。

私のホスティングは、彼らはそれにPDOをインストールしたが問題

マイコードが

<?php 
    $dsn  = 'mysql:dbname=*****;host=localhost'; 
    $username = '*****'; 
    $password = '*****'; 

    // error reporting (this is a demo, after all!) 
    ini_set('display_errors',1);error_reporting(E_ALL); 

    // Autoloading (composer is preferred, but for this example let's just do this) 
    require_once('oauth2-server-php/src/OAuth2/Autoloader.php'); 
    OAuth2\Autoloader::register(); 
    $PDO = new PDO("mysql:dbname=*****;host=localhost",$username,$password); 
    // $dsn is the Data Source Name for your database, for exmaple "mysql:dbname=my_oauth2_db;host=localhost" 
    $storage = new OAuth2\Storage\Pdo(array('dsn' => $dsn, 'username' => $username, 'password' => $password)); 

    // Pass a storage object or array of storage objects to the OAuth2 server class 
    $server = new OAuth2\Server($storage); 

    // Add the "Client Credentials" grant type (it is the simplest of the grant types) 
    $server->addGrantType(new OAuth2\GrantType\ClientCredentials($storage)); 

    // Add the "Authorization Code" grant type (this is where the oauth magic happens) 
    $server->addGrantType(new OAuth2\GrantType\AuthorizationCode($storage)); 

?> 

あるだけPDOのSQLiteドライバ、あなたが示したphpinfo()によると...

+0

@Flosculusそれを説明することはできません。私は$ dsnを知っていません –

+0

申し訳ありません申し訳ありませんが、私のコメントは間違っていたので削除しました。 – Flosculus

+0

私は、エラーがPDOをインストールしたが、MySQLドライバはインストールしていないと思います。 – Barmar

答えて

25

を助けてくださいましょうと言って提供しますがインストールされています。ホスティングプロバイダにPDO MySQLドライバをインストールするように指示する必要があります。

+0

@Barrmarあなたは正しいです:-)ヘルプありがとう –

+0

誰が私に沈黙のdownvoteを与えたのですか?なぜですか? – Barmar

+0

私は知らない。どうして? –

関連する問題