php connection postgreSql

WBOY
Release: 2016-07-29 08:56:46
Original
2709 people have browsed it

S Environment: wampserver64 pHP5.5.12

1. Remove the comma before the extension = php_pdo_pdo_pgsql.dll and extension = php_pgsql.dll; .dll
(libpq.dll under the php folder) and

./php/ext/php_pgsql.dll(php_pgsql.dll under the ext folder)php_pdo_pgsql.dllThese 3 dlls Copy the file to the C drive system32 3.Normally, php can connect to postgres, but I still get an error, prompting "Fatal error: Call to undefined function pg_connect()", check Apache's log, "PHP Startup: Unable to load dynamic library '****\PHP5\ext\php_pdo_pgsql.dll".

After searching, conf in Apache Add LoadFile "***/PHP5/libpq.dll" to the configuration file httpd.conf under the folder, and the location is after LoadModule (*** is the php installation path) 4. Test code

<?php
$conn_string  =  "host=localhost port=5432 dbname=db_name user=your user password=your password" ; 
$dbconn = pg_connect($conn_string);
if (!$dbconn) 
    echo "连接失败!!!!!/r/n";
else 
    echo "连接成功!!!!!/r/n";
    pg_close($dbconn);
?>
Copy after login
Original link:http://www.cnblogs.com/FlyFive/archive/2013/03/11/2954686.html

http://blog.csdn.net/yageeart/article/details/6674296

The above introduces the PHP connection to postgreSql, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!