Uncaught exception thrown in shutdown I am trying to solve this issue from last three days. Searched lot regarding this issue but not getting any solution.

I have also visited these links link1 link2 or duplicate questions

This error is occurring at the time of installation, I am installing Drupal7 on linux

I am using PostgreSQL 9.4.8 database, php PHP 5.5.9

The database user has granted all permissions

following are the exceptions

first exception

    Uncaught exception thrown in shutdown function.

    PDOException: SQLSTATE[42P01]: Undefined table: 7 ERROR: relation &amp;quot;semaphore&amp;quot; does not exist LINE 1: DELETE FROM semaphore ^: DELETE FROM {semaphore} WHERE (value = :db_condition_placeholder_0) ; Array ( [:db_condition_placeholder_0] =&amp;gt; 2108550473576798c2ab0410.91648409 ) in lock_release_all() (line 269 of /var/www/html/rentspeak/includes/lock.inc).


second exception

Uncaught exception thrown in session handler.

PDOException: SQLSTATE[42P01]: Undefined table: 7 ERROR: relation &amp;quot;sessions&amp;quot; does not exist LINE 3: sessions sessions ^: SELECT 1 AS expression FROM {sessions} sessions WHERE ( (sid = :db_condition_placeholder_0) AND (ssid = :db_condition_placeholder_1) ); Array ( [:db_condition_placeholder_0] =&amp;gt; AqE0DsCH1bG6qk3nMspgcEW1J_FUDbF15vNkX5nSdUU [:db_condition_placeholder_1] =&amp;gt; ) in _drupal_session_write() (line 209 of /var/www/html/rentspeak/includes/session.inc).
I just tried to setup a fresh Drupal 7.44 with Postgresql and I haven't encountered any issues. The setup went fine. Here are the steps I did.


$ su root - Switch to root user. 
$ su - postgres - Switch to Postgres user. Note that you need to be root first before doing this.
$ createuser --pwprompt --encrypted --no-createrole --no-createdb gerald - Create a new user called gerald.
$ createdb --encoding=UTF8 --owner=gerald drupal - Create a new database called drupal.
Run the installation and select the Postgresql type. 


Another way to determine the culprit is by reading the logs.

For Postgresql

$ sudo tail -f /var/log/postgresql/postgresql-9.3-main.log. In you case it should be $ sudo tail -f /var/log/postgresql/postgresql-9.4-main.log.

For PHP (if you're using Apache)

$ sudo tail -f /var/log/apache2/error.log

Additional Troubleshooting

Also check if there is a problem with timeout in PHP. You may want to increase to default timeout settings.

My stack:

gerald@von-viel ~/ $ psql --version
psql (PostgreSQL) 9.3.13
gerald@von-viel ~/ $ php --version
PHP 5.5.9-1ubuntu4.17 (cli) (built: May 19 2016 19:05:57)


Note: I am using the default configuration of Postgresql.

Hope this helps!