# How to configure nginx postgresql php on FreeBSD 10



## Mochammad Fajar Kurniawan (May 30, 2017)

Excuse me, I want to configure nginx postgresql php on FreeBSD 10, but I don't know this steps, Can you help me to solved this problem??


----------



## ShelLuser (May 30, 2017)

It's actually not much different from setting this up on any other operating system.

Basically you'd want to install www/nginx and databases/php56-pgsql to begin with. Because of its dependencies the latter port will also pull in PHP and a PostgreSQL client (for example databases/postgresql95-client). Then all that's left to do is to install the right server version.

Installing software should be pretty trivial stuff, check out chapter 4 of the handbook if it isn't, it will explain the full process.

Keep in mind though that installing pre-compiled ("binary") packages will set them up with all default settings. Compiling them yourself through the ports collection will also allow you to set up certain compilation settings.


----------



## balanga (May 30, 2017)

ShelLuser said:


> Installing software should be pretty trivial stuff, check out chapter 4 of the handbook if it isn't, it will explain the full process.



I had a helluva job trying to get the latest version postgresql working with the latest php. After installing postgresql 9.6, php5.6 immediately deleted postgresql96-client, insisting that 9.5 be used. Then when I tried installing php7.1 I came across a whole new battleground. It is doable, but I would hardly call it a trivial task. My experience was several months ago, so things may have changed over that period.


----------



## SirDice (May 30, 2017)

balanga said:


> I had a helluva job trying to get the latest version postgresql working with the latest php. After installing postgresql 9.6, php5.6 immediately deleted postgresql96-client, insisting that 9.5 be used. Then when I tried installing php7.1 I came across a whole new battleground. It is doable, but I would hardly call it a trivial task.


You need to set the correct defaults or you'll keep battling with this. See /usr/ports/Mk/bsd.default-versions.mk:

/etc/make.conf

```
DEFAULT_VERSIONS+= php=7.1 pgsql=9.6
```

Note that the official packages are always built using the default settings and options. If you want or need to deviate from the defaults you'll need to build from ports (or set up your own repository).


----------



## balanga (May 30, 2017)

Yes, I discovered this during my battles...


----------



## Mochammad Fajar Kurniawan (May 30, 2017)

I will try it


----------



## drhowarddrfine (May 30, 2017)

balanga said:


> php5.6 immediately deleted postgresql96-client


No. I don't think so.


----------



## balanga (May 31, 2017)

drhowarddrfine said:


> No. I don't think so.



Did you try?

`pkg install postgresql96-server postgresql96-client`

followed by

`pkg install php56-pgsql`

If not, try it, and tell me what you see.


----------



## SirDice (May 31, 2017)

That's a specific module, your sentence "php5.6 immediately deleted postgresql96-client" implied it was lang/php56  that deleted PostgreSQL. And that's certainly not the case.


----------



## balanga (May 31, 2017)

SirDice said:


> That's a specific module, your sentence "php5.6 immediately deleted postgresql96-client" implied it was lang/php56  that deleted PostgreSQL. And that's certainly not the case.



Ok - maybe that was shorthand... but you won't get far using php with postgresql without installing php-pgsql...


----------

