how to install postgresql12 on Centos 7 with php7 pdo_pgsql driver

Mustafa Ülker
1 min readMay 21, 2020

on cwp

PHP Version Switcher v2

select PHP version

select options you wanted

required options for use with php

(pgsql PostgreSQL driver for PHP.

pdo-pgsql PDO_PGSQL is a driver that implements the PHP Data Objects (PDO) interface to enable access from PHP to PostgreSQL databases.)

follow my instructions to install postgresql-12 & postgresql12-server

sudo yum -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
sudo yum -y install epel-release yum-utils
sudo yum-config-manager --enable pgdg12
sudo yum install postgresql12-server postgresql12
sudo /usr/pgsql-12/bin/postgresql-12-setup initdb
sudo systemctl enable --now postgresql-12
systemctl status postgresql-12sudo firewall-cmd --add-service=postgresql --permanent
sudo firewall-cmd --reload
ln -s /usr/pgsql-12/bin/psql /usr/bin/psql
[root@server /]# su - postgres
Son giriş:21 May Prş 06:08:51 +03 2020 pts/0 üzerinde
-bash-4.2$ psql
psql (12.3)
Type "help" for help.
postgres=# alter user postgres with password 'verystrongpassword'

Enable remote access

sudo nano /var/lib/pgsql/12/data/postgresql.conflisten_addresses = '*'sudo nano /var/lib/pgsql/12/data/pg_hba.conf# Accept from anywhere
host all all 0.0.0.0/0 md5

Restart

sudo systemctl restart postgresql-12

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response