Aman Grover Posted December 25, 2011 Share Posted December 25, 2011 I tried the following script: <?php try { $user='root'; $pass='mysqlmysqli'; $dbh = new PDO ('mysql:hos=localhost;dbname=test',$user,$pass); foreach ($dbh->query('SELECT * FROM albums')as $row) { print_r($row); } $dbh=null; } catch(PDOException $e) { print "Error: ". $e->getMessage()."<br />"; die(); } ?> but it shows "error: could not find driver". I think it is the PHP_MYSQL driver. How can I install it? I looked for it on the net but couldn't find anything. I am just a beginner in PHP. Please help. Quote Link to comment https://forums.phpfreaks.com/topic/253817-how-to-install-php_mysql-driver/ Share on other sites More sharing options...
melloorr Posted December 25, 2011 Share Posted December 25, 2011 How did you install php? Through xampp or a similar program? Quote Link to comment https://forums.phpfreaks.com/topic/253817-how-to-install-php_mysql-driver/#findComment-1301237 Share on other sites More sharing options...
Aman Grover Posted December 25, 2011 Author Share Posted December 25, 2011 I didn't use any application like XAMPP or any other app. , I simply installed PHP, MySQL , and Apache . I tried the phpinfo(); script , and it showed : PDO driver : enabled sqlite2. Quote Link to comment https://forums.phpfreaks.com/topic/253817-how-to-install-php_mysql-driver/#findComment-1301264 Share on other sites More sharing options...
DWilliams Posted December 25, 2011 Share Posted December 25, 2011 I don't know if this works on every platform, but in my particular Linux distro I just had to uncomment "extension=pdo_mysql.so" in php.ini Quote Link to comment https://forums.phpfreaks.com/topic/253817-how-to-install-php_mysql-driver/#findComment-1301282 Share on other sites More sharing options...
Aman Grover Posted December 26, 2011 Author Share Posted December 26, 2011 But I couldn't find any "extension=pdo_mysql.so" or anything like that. Quote Link to comment https://forums.phpfreaks.com/topic/253817-how-to-install-php_mysql-driver/#findComment-1301422 Share on other sites More sharing options...
gork4life Posted December 26, 2011 Share Posted December 26, 2011 If you don't see it then just add it and restart your server. Quote Link to comment https://forums.phpfreaks.com/topic/253817-how-to-install-php_mysql-driver/#findComment-1301427 Share on other sites More sharing options...
Aman Grover Posted December 26, 2011 Author Share Posted December 26, 2011 Thanks a lot, I just found it and uncommented it Quote Link to comment https://forums.phpfreaks.com/topic/253817-how-to-install-php_mysql-driver/#findComment-1301430 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.