Initializing Postgresql 8.x on FreeBSD

I was recently creating a system with FreeBSD 7.x with Postgresql 8.x . The installation was done through ports and it went through smoothly. Instructions at the end of installation process were of no help.

For some reason, it would not initialize the database, nor would it give out any errors. Just to make sure, I ran this command both as root and as postgres user, but the result was same. It would neither log any message to the system log file.

A simple search through the Postgresql docs ( http://www.postgresql.org/docs/8.2/interactive/creating-cluster.html )gave an alternate way which worked for me:

# su - pgsql
$ initdb -D /usr/local/pgsql/data

Amitabh

utf8 encoding and php

There is a very interesting comment on the php website regarding headers and UTF8 encoded files, which deals with the persistent “headers already sent” problem php might have with such files. One can read that here:

http://in2.php.net/manual/en/function.header.php#79579

array_key_exists problem with wordpress installations

If you have recently upgraded your wordpress and you are getting the following errors:
Warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in /wp-includes/category-template.php on line 176

The simplest way is to open the page “category-template.php” in your wp-includes directory, go down to line 176, which should be
if(array_key_exists($category, $categories))
to
if(array_key_exists('$category', $categories))

This should solve all the problems.

Installing GD without X on FreeBSD 6.X

Installing GD library on FreeBSD 6.X, it also installs the X11. If you have updated ports, it tries to install X.Org 7.2 . Now I only use FreeBSD in a server environment, I have no use for the X.org client libraries. So the only thing I do is this:

# cd /usr/ports/graphics/gd
# make clean
# make install WITHOUT_X11=yes

Amitabh