I'm trying to run Symfony on my new Macbook Pro but I have no luck getting it to work with the command line scripts.

With every symfony task related to a database connection the following message appears:

"Couldn't locate driver named mysql"

So I tried testing mysql from the interactive php commandline script. No luck there to.

php > mysql_connect();
PHP Fatal error:  Call to undefined function mysql_connect() in php shell code on line 1

But running the mysql_connect function in the browser does work.

I already found out that php uses a different php.ini for cli scripts but I've had no luck editing that to work with the mysql commands.

Does anybody know whats wrong here?

Thanks in advance!

Btw, I don't use MAMP or anything like that, just the standard php installation from osx snow leopard 5.3+ and installed mysql.

  • Did you ever figure this out? I've been bashing my head against this all day.
    – abeger
    Oct 27, 2012 at 23:31

1 Answer 1


Have you tried using the --php-ini flag to explicitly specify the INI file to load? I.E.

php --php-ini /etc/php.ini -f myfile.php
  • Thanks, but that isn't the solution. I found the cli php.ini and copied the one used for non cli to the cli php.ini but that doesn't make any difference
    – frietkot
    Jul 21, 2011 at 16:57
  • @frietkot Have you tried running phpinfo() from within the CLI? That will give you the 'Loaded php.ini' file (If there is one)
    – Smudge
    Jul 21, 2011 at 19:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.