Pomoc - Szukaj - U¿ytkownicy - Kalendarz
Pe³na wersja: [php][mysql]Uncaught exception 'PDOException' with message 'could not find driver'
Forum PHP.pl > Forum > PHP
Tilosag
Otóż, odpalam pewien skrypcik, który wygląda tak i pobiera dane z install.php.

  1. <?php
  2. /*
  3. General SQL connection handler class with main interface.
  4. */
  5.  
  6. abstract class SQL_Base extends PDO
  7. {
  8. // delimiters for names
  9. protected $leftDelimiter;
  10. protected $rightDelimiter;
  11.  
  12. // prefix for OTSCMS tables
  13. protected $cms_prefix = '';
  14.  
  15. // prefix for OTServ tables
  16. protected $ots_prefix = '';
  17.  
  18. // universal constructor
  19. public function __construct($host, $user, $password, $database, $cms_prefix, $ots_prefix)
  20. {
  21. $this->cms_prefix = $cms_prefix;
  22. $this->ots_prefix = $ots_prefix;
  23.  
  24. parent::__construct( $this->DNS($host, $user, $password, $database), $user, $password);
  25.  
  26. $this->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
  27. $this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  28. }
  29.  
  30. // required for portable DNS generation
  31. abstract protected function DNS($host, $user, $password, $database);
  32.  
  33. // returns field name for query
  34. final public function fieldName($name)
  35. {
  36. return $this->leftDelimiter . $name . $this->rightDelimiter;
  37. }
  38.  
  39. // with this method we dont need to call those ugly OTSTable()/CMSTable()/fieldName() directly
  40. final protected function OTSCMSPrepare($sql)
  41. {
  42. //OTSTable() calls
  43. preg_match_all('/{(.*?)}/', $sql, $matches, PREG_SET_ORDER);
  44. foreach($matches as $match)
  45. {
  46. $sql = str_replace($match[0], $this->fieldName($this->ots_prefix . $match[1]), $sql);
  47. }
  48.  
  49. //CMSTable() calls
  50. preg_match_all('/[(.*?)]/', $sql, $matches, PREG_SET_ORDER);
  51. foreach($matches as $match)
  52. {
  53. $sql = str_replace($match[0], $this->fieldName($this->cms_prefix . $match[1]), $sql);
  54. }
  55.  
  56. //fieldName() calls
  57. preg_match_all('/`(.*?)`/', $sql, $matches, PREG_SET_ORDER);
  58. foreach($matches as $match)
  59. {
  60. $sql = str_replace($match[0], $this->fieldName($match[1]), $sql);
  61. }
  62.  
  63. return $sql;
  64. }
  65.  
  66. // binds OTSCMSPrepare() to basic functions
  67.  
  68. public function query($sql)
  69. {
  70. return parent::query( $this->OTSCMSPrepare($sql), PDO::FETCH_ASSOC);
  71. }
  72.  
  73. public function exec($sql)
  74. {
  75. return parent::exec( $this->OTSCMSPrepare($sql) );
  76. }
  77.  
  78. public function prepare($sql, $options = array() )
  79. {
  80. $statement = parent::prepare( $this->OTSCMSPrepare($sql), $options);
  81. $statement->setFetchMode(PDO::FETCH_ASSOC);
  82. return $statement;
  83. }
  84. }
  85.  
  86. ?>


Podczas instalacji OTSCMS'a (Account Makera - wersja Lite)[http://www.sourceforge.net/projects/otscms]

Wyskakuje następujący błąd:

  1. + Configuration file loaded
  2.  
  3. Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in C:\Program Files\WebServ\httpd\cls\SQL_Base.php:44 Stack trace: #0 C:\Program Files\WebServ\httpd\cls\SQL_Base.php(44): PDO->__construct('mysql:host=loca...', 'root', 'twoja') #1 C:\Program Files\WebServ\httpd\install.php(141): SQL_Base->__construct('localhost', 'root', 'twoja', 'otserv', 'otscms_', '') #2 {main} thrown in C:\Program Files\WebServ\httpd\cls\SQL_Base.php on line 44


Najdziewniejsze jest to, że posiadam plik php_pdo_mysql.dll, więc w czym problem?



sf
W php.ini ³adujesz go?
Tilosag
Gdy zrobię takie coś:

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-type" content="text/html; charset=iso-8859-2">
  5. <meta http-equiv="Creation-date" content="2007-04-12T18:15:13Z">
  6. <meta name="Authoring-tool" content="Pajaczek NxG PRO v5.6.1">
  7. </head>
  8.  
  9. <body>
  10. <?php
  11. ini_set ('PDO_MYSQL',1);
  12. ?>
  13. </body>
  14. </html>

To dalej jest disabed!

Jak to włączyć?!

EDIT:

Znalazłem coś w sieci i z przerażeniem ogłaszam, że chyba trzeba dokompilować to do serwera?!
To jest wersja lo-fi g³ównej zawarto¶ci. Aby zobaczyæ pe³n± wersjê z wiêksz± zawarto¶ci±, obrazkami i formatowaniem proszê kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.