Koozali.org: home of the SME Server
Obsolete Releases => SME 7.x Contribs => Topic started by: jester on December 05, 2006, 12:56:33 PM
-
Hi,
Has anyone got a clue on how to make PHP on SME7 play with PostgreSQL?!
I've installed sql-ledger with help from the howto in the wiki, but now i want to make a connection with PHP to the pgsql db.
jester.
-
Ok...
Found out that an additional module for PHP is needed, i've added this module, loaded it via some custom template fragments (a phpinfo() shows it as enabled). But i still cannot connect to my db...
Does someone know if there is some port or SME7 db parameter that needs to be set so i can get access from a php script?!
kind regards,
jester.
-
No one who can help me on this? I'm really stuck.
Sql-ledger is working so perl can access the DB, so the Postgres is installed properly. I've loaded the postgres module for PHP correctly, as shown by phpinfo() i'm using the same username and pass as for sql-ledger so that should be no problem. All is on the same SME7 server, both perl and php files are in the same dir. As a test i've got the following simple script:
<?php
$connection = pg_connect("dbname='<my_db>' port='5432' user='<username>' password='<user_pass>' host='localhost'");
if (!$connection) {
print("Connection Failed.");
phpinfo(INFO_MODULES);
exit;
}
echo("<strong>SUCCESS !!</strong>");
?>
Any help on this is appreciated,
jester.
-
Okay, solved my problem and for anyone who likes to know:
Looking at the messages log there was the following error:
httpd: PHP Warning: pgsql: Unable to register functions, unable to load in Unknown on line 0
I had made a custom php.ini template fragment for loading the the newly installed pgsql.so module. Eventough this module is non SME7 standard it seems that it is loaded automatically when put in right dir and loading it explicitly in php.ini gives problems.
Maybe this is obvious for a non newbie, but it had me stuck for quite a few days (thus stating that i'm a newbie ;-) )
jester.
-
jester: if you're a newbie then that puts the rest
of us back to the merest glint in the eye of a 'bie;~)