Symfony + Mac OS X + pdo_mysql.so
I recently started working my way into the world of the PHP framework Symfony. While following the superb Jobeet tutorial, I encountered an error involving PDO_MYSQL and Mac OS X. I spent an hour trying to trace down the problem and another hour finding a solution. And as always, when something takes me too long to solve, I write a guide for it!
The setup
I tried to run this command while following the Jobeet tutorial:
php symfony propel:insert-sql
The error
>> schema converting "/Users/eyeRmonkey/w...obeet/config/schema.yml" to XML >> schema putting /Users/eyeRmonkey/works...eet/config/generated-schema.xml >> propel Running "insert-sql" phing task Execution of target "insert-sql" failed for the following reason: /Users/eyeRmonkey/workspace/jobeet/lib/vendor/symfony/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/build-propel.xml:275:1: [wrapped: could not find driver] [phing] /Users/eyeRmonkey/workspace/jobeet/lib/vendor/symfony/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator/build-propel.xml:275:1: [wrapped: could not find driver] Some problems occurred when executing the task: build-propel.xml:275:1: [wrapped: could not find driver] If the exception message is not clear enough, read the output of the task for more information
The root problem
The distribution of PHP that comes with OS X doesn’t have the pdo_mysql.so library loaded. You can determine this by looking at output from php -m.
The solution
After much searching, I finally discovered the proper way to compile the pdo_mysql.so library. This all assumes that you have PHP and MySQL installed the same way I do. (source)
Compiling PDO_MYSQL:
- Download PDO_MYSQL
- Run the following commands (replacing x.x.x with the version of PDO_MYSQL that you downloaded)
cd ~/Downloads/PDO_MYSQL-x.x.x/PDO_MYSQL-x.x.x phpize ./configure '--with-pdo-mysql=shared,/usr/local/mysql' make sudo make install
Updating your PHP configuration:
Now add the following two lines to the file /etc/php.ini under the “Dynamic Extensions” section:
extension_dir = "/usr/lib/php/extensions/no-debug-non-zts-20060613" extension=pdo_mysql.so
Save the file and you’re done.
The conclusion
Many people had this problem. It shouldn’t take hours of detailed searching to find a solution. Back to Symfony!




















Thank you! Thank you! Thank you!
It took me *hours* of searching and finally found this page and I followed your instruction to install pdo_mysql.so and I was able to bypass the problem:
“Some problems occurred when executing the task:
Thanks for the article. I followed the instruction and can get pass the command line portion of the tutorial. But now when I hit the browser, it said “Unable to open PDO connection [wrapped: could not find driver]. Guess that’s what you mean in the updated section. Any quick fix for that?
As far as I can tell, the problem is not something you can fix. That’s why I ditched the built in version of Apache/PHP and went with MAMP instead.
Woot! Thanks for the tip. This finally got Symfony working for me with MySQL.
big thanks, very simple and easy decision for this problem, i had afraid that i need to recompile PHP…
You really saved my life! However:
[05-Aug-2009 16:38:54] PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php/extensions/no-debug-non-zts-20060613/pdo_mysql.so’ - (null) in Unknown on line 0
What does this mean?
I installed PDO_Mysql following your instructions in mac .
It did well and also mofified php.ini file
but on restarting server it’s not showing up