Skip to content

Instantly share code, notes, and snippets.

@Piokaz
Piokaz / upgrade-postgres-9.4-to-9.6.md
Created February 12, 2018 02:59 — forked from dmitrykustov/upgrade-postgres-9.4-to-9.6.md
Upgrading PostgreSQL from 9.4 to 9.6 on Debian Jessie

To use the most modern version of Postgres software we need to add postgresql repository. Edit /etc/apt/sources.list or create /etc/apt/sources.list.d/pgdg.list and add there a line: deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main Then import the repository signing key, and update the package lists:

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update

Install a new version of PostgreSQL server.

Once the Debian upgrade finished, I used dpkg-query -l postgresql* to check which versions of postgres I have installed.

@Piokaz
Piokaz / gist:8153203
Created December 27, 2013 21:57
PHP PDO Default Mysql
try{
$options = array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ
);
$DB = new PDO('mysql:host=localhost;dbname=dbname', 'basename', 'password', $options);
}catch(PDOException $e){
exit('Impossible de se connecter !');