PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, January 15, 2022

[FIXED] PDOException "could not find driver" on MAMP

 January 15, 2022     mamp, pdo, php     No comments   

Issue

I'm trying to work with PDO on my localhost. I'm running MAMP on OSX 10.7.4.

I've checked phpinfo(), and as far as I can see I should be fine.

enter image description here

I checked the php.ini to see that "extension=pdo_mysql.so" is in fact uncommented.

I read some were that I had to make the file PROJECTFOLDER/config/parameters.ini with the following content so i did, but with no luck. (Changed it to reflect my setup of cause)

database_driver   = pdo_mysql
database_host     = localhost
database_port     =
database_name     = databasename
database_user     = msqlusername
database_password = mysqlpassword//if not make blank

mailer_transport  = smtp
mailer_host       = localhost
mailer_user       =
mailer_password   =

locale            = en

secret            = ThisTokenIsNotSoSecretChangeIt

Any ideas as to how I can get PDO up and running?

BTW I'm using the following code to make the connection:

try {  
    $host = 'localhost';
    $dbname = 'ifjernsyn';
    $user = 'root';
    $pass = 'root';

    # MS SQL Server and Sybase with PDO_DBLIB  
    $DBH = new PDO("mssql:host=$host;dbname=$dbname, $user, $pass");  
    $DBH = new PDO("sybase:host=$host;dbname=$dbname, $user, $pass");  

    # MySQL with PDO_MYSQL  
    $DBH = new PDO("mysql:host=$host;dbname=$dbname", $user, $pass);  

    # SQLite Database  
    $DBH = new PDO("sqlite:my/database/path/database.db");  
}  
catch(PDOException $e) {  
    echo $e->getMessage();  
} 

Solution

So there is not mssql and sybase 's driver.

You need PDO_DBLIB to access Microsoft SQL Server and Sybase databases.



Answered By - xdazz
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing