Tuesday, 15 July 2014

php - Fatal error: Call to undefined function pg_connect -



php - Fatal error: Call to undefined function pg_connect -

i using windows 7, php 5.3.5 , wamp server. have 2 php files: trigger.php , background.php. want run background.php background process. have phone call file trigger.php. accomplish used below method. included next code in trigger.php create background.php process in background.

$handle = popen('start /b c:\wamp\bin\php\php5.3.5\php.exe c:\wamp\www\email3.php','r');

in background.php have follwing code connect database.

$conn_string = "host=localhost port=5432 dbname=tagbase user=postgres password=postgres";

now, on parsing line getting follwing error :

fatal error: phone call undefined function pg_connect() in c:\wamp\www\background.php on line 3 phone call stack: 0.0002 322792 1. {main}() c:\wamp\www\background.php:0

by searching in in net found solutions, , made changes recommended below in php.ini,

uncommented, extension=php_pdo_pgsql.dll, uncommented, extension=php_pgsql.dll, uncommented, extension_dir = "c:/wamp/bin/php/php5.3.5/ext/",

also have php_pdo_pgsql.dll , php_pgsql.dll files in c:/wamp/bin/php/php5.3.5/ext/ folder.

any suggestions appreciated.

apache 2.2.x configuration

add next line apache 2.2.x httpd.conf configuration:

loadfile "c:/program files/postgresql/{version}/bin/libpq.dll"

above line must entered before next line.

loadmodule php5_module "c:/wamp/bin/php/php5.2.11/php5apache2_2.dll"

php 5.2.x configuration

enable next 2 lines in php.ini configuration file. 'enable' mean, remove trailing ; (semicolon). these, un-comment line.

extension=php_pdo_pgsql.dll extension=php_pgsql.dll

restart wamp

test adding in index.php

echo extension_loaded('pgsql') ? 'yes':'no';

(source: http://www.plaatsoft.nl/wamp-postgresql-integration/)

php windows wamp

No comments:

Post a Comment