How can I get PDO to work on my mac (os x 10.5)? I’m using the built in php and php in Zend/Eclipse. Can’t seem to find useful drivers for it at all.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I had to install the PDO_PGSQL driver recently on Leopard, and I ran across a multitude of problems. In my search for answers, I stumbled across this question. Now I have it successfully installed, and so, even though this question is quite old, I hope that what I’ve found can help others (like myself) who will undoubtedly run into similar problems.
The first thing you’ll need to do is install PEAR, if you haven’t done so already, since it doesn’t come installed on Leopard by default.
Once you do that, use the PECL installer to download the PDO_PGSQL package:
(Note: you may have to run
peclas the superuser, i.e.sudo pecl.)After that, since the PECL installer can’t install the extension directly, you’ll need to build and install it yourself:
If all goes well, you should have a file called “
pdo_pgsql.so” sitting in a directory that should look something like “/usr/lib/php/extensions/no-debug-non-zts-20060613/” (the PECL installation should have outputted the directory it installed the extension to).To finalize the installation, you’ll need to edit your
php.inifile. Find the section labeled “Dynamic Extensions”, and underneath the list of (probably commented out) extensions, add this line:Now, assuming this is the first time you’ve installed PHP extensions, there are two additional steps you need to take in order to get this working. First, in
php.ini, find theextension_dirdirective (under “Paths and Directories”), and change it to the directory that thepdo_pgsql.sofile was installed in. For example, myextension_dirdirective looks like:The second step, if you’re on a 64-bit Intel Mac, involves making Apache run in 32-bit mode. (If there’s a better strategy, I’d like to know, but for now, this is the best I could find.) In order to do this, edit the property list file located at
/System/Library/LaunchDaemons/org.apache.httpd.plist. Find these two lines:Under them, add these three lines:
Now, just restart Apache, and PDO_PGSQL will be up and running.