None of the supported PHP extensions (PgSQL, PDO_PgSQL) are available - postgresql

i have enabled extension=php_pdo_pgsql.dll and extension=php_pgsql.dll in my php.ini file but still unable to get adminer to work.
and also sudo service apache2 restart

sudo apt-get install php7.0-pgsql
cd /etc/postgresql/9.5/main
sudo nano pg_hba.conf
local all postgres peer
should be
local all postgres md5
sudo service postgresql restart
then you good to go :)

Related

How do i install Postgres on Ubuntu and create a superuser?

I have successfully installed Postgres on Ubuntu 20.04 by running the following commands:
$ sudo apt-get update
$ sudo apt-get install postgresql postgresql-contrib libpq-dev
which was successful. I then run the command:
$ sudo service postgresql start
which was also successful.
However, the command
$ sudo -u postgres createdb $USER
failed. The error message was as follows:
createuser: error: could not connect to database template1: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Please help me out.

Start a postgres server with pgadmin

I'm trying to start a postgreSQL server in Debian 10 in order to access this database: https://catalogofraneitalia.wordpress.com/database/.
I have never used postgreSQL before and I have tried to follow the instructions I found on the internet. This is what I have run up to now:
sudo apt -y install gnupg2
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" |sudo tee /etc/apt/sources.list.d/pgdg.list
sudo apt update
sudo apt -y install postgresql-11
sudo apt install postgis postgresql-11-postgis-3
I checked that postgreSQL is active, enabled and accepting connections
sudo su - postgres, psql and create user username with superuser password 'password' with the username and password chosen
sudo apt install pgadmin3 pgadmin3-data
I opened pgadmin and I cliked on Add server, inserting the username and password previously created and I received the message Peer authentication failed for user "username"
the correct steps to install pg are in the official site: https://www.postgresql.org/download/
Follow the steps on screen, once initialized you can open the port (listen_address and pg_hba.conf), restart the service, and done... you can connect from other machine.
Other thing, pgadmin3 is deprecated, try using pgadmin4.

Postgresql 9.5 on ubuntu

im try install postgresql on ubuntu using this tutorial
https://www.youtube.com/watch?v=dSqosCc_KLA
And im stop on step when print comand psql 4:54 seconds video
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
This is a known issue, I had that too. Try to reinstall postgresql with a version number. Remove your postgres and reinstall it. For example:
sudo apt-get install postgresql-9.5
An other fix would be to create a softlink for example:
ln -s /tmp/pgsql.5432 /var/run/postgresql/pgsql.5432
I would suggest you to reinstall postgresql like I said in point 1.
Note: default port of postgresql is 5432

Error while connecting to remote Postgres on centos

When I'm trying to connect to Postgres on remote cloud . It is showing :
psql: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
Local system -- Postgres 9.3 (windows)
Remote System is on Azure -- Postgres 9.2(centos)
Command I'm using: psql -h "abc.cloudapp.net" -p 5432
I've set the end-point as 5432 in azure
changed the postgresql.conf to "*" to allow connection
and changed the pg_hba to (host all all ip/24 md5)
Please help me out on this.
Endpoint is OK, and you need to set up the network security group as well.
Try to define not just 5432, but the range of ports (1024-65536 for example).
UPD: I was able to create the CentOs 7.0 + PostgreSQL and connected to that instance:
sudo yum install postgresql-server postgresql-contribs
sudo postgresql-setup initdb
sudo vi /var/lib/pgsql/data/pg_hba.conf
Edit 127.0.0.1/32 to 0.0.0.0/0
sudo systemctl start postgresql
sudo systemctl enable postgresql
sudo vim /var/lib/pgsql/data/postgresql.conf
sudo service postgresql restart
sudo service postgresql restart
sudo -u postgres createuser --superuser azureuser -P
Then i downloaded pgAdmin and connected to that. (see screenshot) (do not pay attention to the test1 database, just change it to postgres).

Postgresql installation Error Ubuntu 14.04

I've tried to install Postgres for the past few days on Ubuntu 14.04. I have followed this set of commands:
sudo apt-get update && sudo apt-get upgrade
sudo apt-get purge postgresql
sudo apt-get -f install
sudo apt-get install postgresql
With no such luck... The error message I get is as follows:
postgres#CouchVictory:~$ psql
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
I've also tried the suggestion here and I've made sure that my shell is a login shell. Any suggestions?