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

查看:24
本文介绍了在 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指令(在Paths and Directories"下),将其更改为pdo_pgsql.so所在的目录code> 文件已安装.例如,我的 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 位模式下运行.(如果有更好的策略,我想知道,但就目前而言,这是我能找到的最佳策略.)为此,请编辑位于 /System/Library/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天全站免登陆