Rodrigo Rodrigo - 3 months ago 25
PHP Question

ubuntu php_pgsql.dll not found

I installed Apache2 on Ubuntu 14.04, with php 5.5.9. I see the Apache screen, the phpinfo screen, but php can't connect to postgresql.

I get "Fatal error: Call to undefined function pg_connect()" when I try.

My php.ini acording to 'phpinfo();' is:

Loaded Configuration File /etc/php5/apache2/php.ini


In php.ini I have a [PostgreSQL] section, but no

;extension=php_pgsql.dll


and the file doesn't exist.

The modules loaded include mod_php5, but no *pgsql...

I guess the proxy in my institution has blocked something?

[PostgreSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0

Answer

In your terminal:

sudo apt-get install php5-pgsql

When installing finish

/etc/init.d/apache2 restart

And check your postgres db connection.