warning: Creating default object from empty value in /home/cvickery/drupal-6.19/modules/taxonomy/ on line 34.

PHP and CSV files

If you have ever tried to use PHP to process CSV files that contain non-ASCII characters, you know there is a problem out there with lots of solutions that may or may not work. Mostly the latter from what I can tell. Herewith some comments from a PHP command line program that I use to populate a PostgreSQL table with data derived from a spreadsheet.

This is all command-line stuff under OS X.

psql tunnel

This will set up a tunnel between the local machine and a computer named where I have already added the public key for my local machine to the .ssh/authorized_keys file.

ssh -N -L 2110/localhost/5432

Then you could do, for example:

psql -h localhost -p 2110 dbname

Add -f to make the ssh command run in the background.
The -N option says just to set up the tunnel without running any commands on the remote host.

Installing PHP support for PostgreSQL on an OS X Leopard Server

OS X Leopard Server runs apache2 as a 64-bit application, which means that if you want to be able to run a PostgreSQL server that you can access from PHP web pages, PostgreSQL has to be built as a 64-bit binary, and PHP has to be re-built (with PostgreSQL) as a 64-bit binary as well. After some googling around, I started by using a script by Marc Liyanage for building a universal binary PostgreSQL. That was a good start, but didn't work on my Leopard server. What follows is a description of how I finally got it all to work.

Syndicate content