Home  >  Article  >  Backend Development  >  PostgreSQL连接PHP_PHP

PostgreSQL连接PHP_PHP

WBOY
WBOYOriginal
2016-05-31 19:28:49919browse

安装

PostgreSQL的扩展是默认启用的最新版本的PHP5.3.x.但是它可能通过在编译时加上--without-pgsql 选项禁用。但仍然可以使用yum命令安装PHP的PostgreSQL的接口:

<ol class="dp-xml"><li class="alt"><span><span>yum install php-pgsql </span></span></li></ol>

在开始使用PHP PostgreSQL接口,打开pg_hba.conf文件(在PostgreSQL安装目录),并添加下面一行:

<ol class="dp-xml">
<li class="alt"><span><span># IPv4 local connections: </span></span></li>
<li><span>host    all         all         127.0.0.1/32          md5 </span></li>
</ol>

使用start/restart启动Postgres服务器,它没有运行使用下面的命令:

<ol class="dp-sql">
<li class="alt"><span><span>[root@host]# service postgresql restart </span></span></li>
<li><span>Stopping postgresql service:                               [  OK  ] </span></li>
<li class="alt"><span>Starting postgresql service:                               [  OK  ] </span></li>
</ol>

Windows用户必须启用php_pgsql.dll为了使用这个扩展。这个DLL包含带Windows分布在最新版本PHP5.3.x

有关详细的安装说明,请查看我们的PHP教程和其官方网站上。

PHP 接口APIs

以下是重要的PHP程序,可以连接使用PostgreSQL数据库PHP程序。如果正在寻找一个更复杂的应用程序,那么可以看看到PHP官方文件。

Windows用户必须启用php_pgsql.dll为了使用这个扩展。这个DLL包含带Windows分布在最新版本PHP5.3.x

有关详细的安装说明,请查看我们的PHP教程和其官方网站上。

PHP 接口APIs

以下是重要的PHP程序,可以连接使用PostgreSQL数据库PHP程序。如果正在寻找一个更复杂的应用程序,那么可以看看到PHP官方文件。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn