Where is libpq-fe.h



Reaction score: 3
Messages: 25

I'm considering the thought of making a website in C, with Postgres as data backend.

Yes, I do know that it might not be the best idea, but it's high time I learned some C.

As such I would probably need access to libpq-fe.h, the Postgres C bindings, but alas, after searching the Ports Collection, Google and even grepping they entire filesystem on the Jail with Postgres installed on, I am unable to find libpq-fe.h.

Does anyone know how to install libpq-fe.h?


Staff member

Reaction score: 12,744
Messages: 39,332

but it's high time I learned some C.
That's good of course but building a website in C is probably not the best to start with. Websites are, in general, not written in C, there are far better suited languages to use (PHP, Ruby on Rails, Java, etc.) for that. Web applications also require in-depth knowledge on how to program securely, something you haven't mastered yet. If I were you I would start with 'simple' console only type applications. Those will be complex enough to start with.



Reaction score: 3
Messages: 25

Thank you for the reply, it's always a pleasure to read.

I've been making websites for ~20 years now, when not using something like Wordpress or other frameworks. These last years it's been with PHP and Python (+ a little Perl) when I needed something interactive like a database, but I find PHP increasing harder to use, mostly due to inconsistencies in the language itself.

On a site note, in the beginning I used to write the HTML by hand, because I couldn't program back then.

Besides that I've made a few daemons in Perl and a bunch of shell scripting. And most likely some other stuff, including some simple C stuff a few years back, involving GTK. Once GTK was introduced, it wasn't simple anymore, though.

This website I would like to do, is meant to handle human based text, and as such should support Unicode through UTF8, something Python seems unwilling to do, when I give it my best. I'm sure the fault is all mine, but still, it would be nice to use a language I find easy to use.

Easy might not be the same as simple or fast to program in, in this case, since I would like a greater degree of control over the program / website than they other languages gives. I hope it makes sense, since English is not my first language.


New Member

Reaction score: 2
Messages: 2

It blows my mind that not a single person here actually answered his question.

The answer is to install a postgresql-client package. Just run
pkg search 'postgresql.*-client'
and install the specific version you need, or the most recent version if you don't have that constraint.

As for the other people replying here... seriously. WTF?



Reaction score: 744
Messages: 1,284

Actually, if he's installing the postgres server the client is brought in anyway.
Off-hand your include path on the compile would be: -I/usr/include to get libpq-fe.h
Postgres is a good choice, in my opinion the api is much more intuitive than mysql.

I agree with SirDice that C/C++ is really inappropriate for website building. It can be done, of course, but there's far better higher level languages to use.