1

I woork on my local site with MAMP. Everything was going right till yesterday. Now, when I run my code, I get a : "Fatal error: Uncaught exception 'PDOException' with message 'could not find driver'..." It seems that I have non installed driver but it worked well until this day. How can I fix this problem ?

Best, Newben

Firas Assaad
  • 25,006
  • 16
  • 61
  • 78
epsilones
  • 11,279
  • 21
  • 61
  • 85
  • For informations, I uncommented on my php.ini file the correct extensions : extension=pdo_mysql.so,etc.. Btw, perhaps there is a problem with the error warnings I changed yesterday ! – epsilones Jun 06 '12 at 11:04
  • Did you changed the PDO DSN? Maybe you have a typo there, like an invalid DSN prefix. – CodeZombie Jun 10 '12 at 16:25

2 Answers2

2

Have you installed MacPorts? If your answer is "yes" open your Shell and type:

  1. cd ~/
  2. sudo nano .profile
  3. change: export PATH=/opt/local/bin:/opt/local/sbin:$PATH
    replace with: export PATH=/Applications/MAMP/Library/bin/:/Applications/MAMP/bin/php/php5.3.6/bin/:$PATH

  4. close your Shell and re-open it

This is all. I found the solution here: thewebfactory

ssuperczynski
  • 3,190
  • 3
  • 44
  • 61
Sfblaauw
  • 1,556
  • 18
  • 21
1

I had a similar problem. Sfblaauw's solution didn't work but it helped me identify the problem. First I installed php5-mysql using MacPorts:

sudo port install php5-mysql

During installation, I got the following warning:

Your php.ini contains a line that will prevent php5-mysql and other PHP extensions from working. To fix this, edit /opt/local/etc/php5/php.ini and delete this line:

extension_dir = "/usr/lib/php/extensions/no-debug-non-zts-20090626"

I commented out the line and restarted Apache. Everything seems to work fine now.

Firas Assaad
  • 25,006
  • 16
  • 61
  • 78