# [solved] apache2 php5 pgsql problem

## Dagger

Hi,

I've got a strange problem with php and apache support for pgsql

When I create a very simple php file

```

<?php

pg_connect();

?>

```

and try to see the error message from the web browser I get:

```

Fatal error: Call to undefined function pg_connect() in /var/www/localhost/htdocs/index.php on line 4

```

php index.php from a command line

i got

but when I try the same from command like with

```

Warning: Wrong parameter count for pg_connect() in /var/www/localhost/htdocs/index.php on line 4

```

exactly as expected

So my question is ... why the hell apache mod does not see my pgsql support?

Of course php is compiled with postgres flag. It must be something stupid that apache php.ini does not load psql.so extension.

----------

## hoffie

Please also post emerge -pv php

Just a guess: You compiled php with sharedext support (and as such pgsql support got build as a loadable extension) and the extension is only active for the CLI "profile" (i.e. /etc/php/apache2-php5/ext-active/ misses the correct symlink).

----------

## Dagger

These packages will be installed:

* dev-lang/php-5.2.4_p20070914-r2 {:5} [R] (-adabas) apache2 bcmath berkdb (-birdstep) bzip2 calendar cdb cgi -cjk cli concurrentmodphp crypt ctype curl curlwrappers -db2 dbase (-dbmaker) -debug discard-path -doc (-empress) (-empress-bcs) (-esoob) -exif -fastbuild (-fdftk) filter (-firebird) flatfile force-cgi-redirect (-frontbase) ftp -gd -gd-external gdbm gmp hash iconv imap inifile -interbase -iodbc ipv6 -java-external -json kerberos ldap -ldap-sasl -libedit mcve mhash -msql -mssql -mysql -mysqli ncurses nls -oci8 -oci8-instant-client -odbc pcntl pcre pdo -pdo-external pic posix postgres -qdbm readline -recode reflection -sapdb session sharedext -sharedmem simplexml snmp -soap sockets (-solid) spell spl -sqlite ssl suhosin (-sybase) (-sybase-ct) sysvipc threads tidy tokenizer -truetype unicode wddx xml xmlreader xmlrpc xmlwriter -xpm xsl yaz zip -zip-external zlib

Total: 1 package (1 rebuild)

 *Quote:*   

> 
> 
> lease also post emerge -pv php
> 
> Just a guess: You compiled php with sharedext support (and as such pgsql support got build as a loadable extension) and the extension is only active for the CLI "profile" (i.e. /etc/php/apache2-php5/ext-active/ misses the correct symlink).
> ...

 

Yep you are perfectly right!

few symlinks and its fine  :Smile: 

thank you

----------

## thecooptoo

ive got this problem as well - can you explain the solution ( in 'read my lips' language)  please

----------

## Dagger

 *thecooptoo wrote:*   

> ive got this problem as well - can you explain the solution ( in 'read my lips' language)  please

 

Go to your /etc/php/apache2-php5/ext and ext-active and check the files you've got there.

also check /etc/php/cli-php5/ext and ext-active and compare them. Make all the nessesary symbolic links, and it will be fine.

----------

