在Mac上安装PostgreSQL的PDO驱动程序(使用Zend for eclipse) [英] Installing PDO-drivers for PostgreSQL on Mac (using Zend for eclipse)

查看:178
本文介绍了在Mac上安装PostgreSQL的PDO驱动程序(使用Zend for eclipse)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何让PDO在我的Mac(os x 10.5)上工作?我在Zend / Eclipse中使用了内置的php和php。似乎找不到有用的驱动程序。

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.

推荐答案

我最近不得不在Leopard上安装PDO_PGSQL驱动程序,我遇到了很多问题。在寻找答案时,我偶然发现了这个问题。现在我已经成功安装了,所以即使这个问题很旧,我希望我发现可以帮助别人(像我一样),无疑会遇到类似的问题。

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.

您需要做的第一件事是安装PEAR ,如果你还没有这样做,因为默认情况下它不会安装在Leopard上。

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.

一旦你这样做,使用PECL安装程序下载PDO_PGSQL包:

Once you do that, use the PECL installer to download the PDO_PGSQL package:

$ pecl download pdo_pgsql
$ tar xzf PDO_PGSQL-1.0.2.tgz

(注意:您可能必须运行 pecl 超级用户,即 sudo pecl 。)

(Note: you may have to run pecl as the superuser, i.e. sudo pecl.)

之后,由于PECL安装程序无法直接安装扩展,您需要自行构建和安装它:

After that, since the PECL installer can't install the extension directly, you'll need to build and install it yourself:

$ cd PDO_PGSQL-1.0.2
$ phpize
$ ./configure --with-pdo-pgsql=/path/to/your/PostgreSQL/installation
$ make && sudo make install

如果一切顺利,你应该有一个名为 pdo_pgsql.so 坐在一个目录下,应该看起来像 / usr / lib / php / extensions / no-debug-non-zts-20060613 / (PECL安装应该输出安装扩展名的目录)。

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).

要完成安装,您需要编辑您的 php.ini 文件。查找标有动态扩展的部分,并在(可能注释掉的)扩展名列表的下方添加以下行:

To finalize the installation, you'll need to edit your php.ini file. Find the section labeled "Dynamic Extensions", and underneath the list of (probably commented out) extensions, add this line:

extension=pdo_pgsql.so

现在,假设这是您第一次安装PHP扩展,您需要采取两个额外的步骤才能使其工作。首先,在 php.ini 中,找到 extension_dir 指令(在路径和目录下),并将其更改为目录中安装了 pdo_pgsql.so 文件。例如,我的 extension_dir 指令看起来像:

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 the extension_dir directive (under "Paths and Directories"), and change it to the directory that the pdo_pgsql.so file was installed in. For example, my extension_dir directive looks like:

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

第二步,如果您使用的是64位Intel Mac,则涉及使Apache以32位模式运行。 (如果有一个更好的策略,我想知道,但现在,这是最好的我可以找到。)为了做到这一点,编辑属性列表文件位于 /系统/库/LaunchDaemons/org.apache.httpd.plist 。找到这两行:

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:

<key>ProgramArguments</key>
<array>

根据他们,添加以下三行:

Under them, add these three lines:

<string>arch</string>
<string>-arch</string>
<string>i386</string>

现在,只需重新启动Apache,PDO_PGSQL将会启动并运行。

Now, just restart Apache, and PDO_PGSQL will be up and running.

这篇关于在Mac上安装PostgreSQL的PDO驱动程序(使用Zend for eclipse)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆