# Installing Drupal with Postgresql



## balanga (May 14, 2016)

I'm trying to install Drupal using Postgresql as the backend database and have read that I need something called php5-pdo_pgsql to be able to configure Drupal to use Postgresql.

It is mentioned here:-

https://www.freshports.org/databases/php5-pdo_pgsql/

but is not available as an installable PKG. Can I tell if Postgresql on FreeBSD is built with this option?

And does anyone know of any guides for setting up Drupal/Postgresql/FreeBSD?


----------



## Abriel (May 14, 2016)

What version PHP do you use?

There is databases/php55-pdo_pgsql and databases/php56-pdo_pgsql

You can install drupal from ports, and it will install all dependencies: www/drupal7. Just `make config` and select 
	
	



```
PostgreSQL database support
```


----------



## balanga (May 15, 2016)

Actually after looking again at Drupal, it looks as though using with Postgresql is supported out of the box with Drupal 8  and includes a INSTALL.pgsql.txt for installing with Postgresql.

Unfortunately my install falls at the first hurdle in Install.php with



```
[:error] [pid xxxxxx] [client xxxxxxx] PHP fatal error: Call to undefined function Symfony//Component//Yaml//ctype_digit() in ****

/usr/local/www/apache24/data/drupal/vendor/symfony/yaml/Inline.php on line 504

that line contains:

case ctype_digit($scalar):
```

**** the line marked with **** should have backslashes rather than forward slashes 

I'm using FreeBSD 10.3-RELEASE with Xfce and the backslash key prints a '<'. No idea why...


----------



## ondra_knezour (May 15, 2016)

You are probably missing the textproc/php56-ctype extension. There are https://www.drupal.org/requirements/php but the "list" is little chaotic.


----------



## Abriel (May 15, 2016)

I would install Drupal 7 from the ports to get all dependencies. www/drupal7


----------



## balanga (May 15, 2016)

Many thanks. Very grateful for this.


----------



## balanga (May 15, 2016)

Abriel said:


> I would install Drupal 7 from the ports to get all dependencies. www/drupal7



Getting Drupal7 to play nicely with Postgresql involves more hacking than I'm comfortable with.


----------



## balanga (May 16, 2016)

It seems that I am missing PDO support for POSTGRESQL in PHP.

How do I add it? Is there a PKG I need to install?


----------



## SirDice (May 18, 2016)

See post #2.


----------



## balanga (Dec 26, 2016)

After getting Drupal 8 working with Postgresql six months ago it stopped working and now I'm trying to get it working again, but have the same problems in not seeing Postgresql as a database option for Drupal. This time I'm trying to use Postgresql 9.6 but when attempting to install php56-pdo_pgsql, postgresql93_client is a dependency so postgresql96_client will most likely be removed.

Is there any way to remove this dependency? If I try to build from source will there be also an attempt to make this backlevel version of the client?


----------



## julp (Dec 26, 2016)

Retry after overidding default version from 9.3 to 9.6 with: 
	
	



```
echo 'DEFAULT_VERSIONS+=pgsql=9.6' >> /etc/make.conf
```


----------

