Adding Perl support for MySQL on Mac OS X part 3

January 13th, 2006

Now we have MySQL up and running, it’s time for the Perl support. Mac OS X comes with a standard Perl port, without the MySQL support. It is not advisable to add modules to the this built-in port of Perl, it is possible a Mac OS X software update from Apple could temper with the additions. Instead, we will install a completely separate port of Perl, and to this port we will add the MySQL support. First, go to the ActivePerl download page, follow the ‘Download ActivePerl’ link, fill in or skip the form, and download the ‘Mac OS X’ version. Mount the downloaded image, and double-click the installer. This will install the ActivePerl port in the /usr/local directory on your harddisk.

Open a terminal window (I prefer to use iTerm), and type:

cd /usr/local

Give yourself a root-password (choose a good one!):

sudo passwd root

And become root:

su

Now, type (with your version number of ActivePerl) to create a convenient path to the new Perl:

ln -s ActivePerl-5.8 perl

The new Perl is now available as /usr/local/perl/bin/perl, if you want to use it your file with Perl commands should start with:

#!/usr/local/perl/bin/perl

Adding MySQL support for this Perl

This new Perl has now been installed, but it is still without the support for MySQL! So finally we will come to the last step in this process. Type in the terminal window:

cd perl/bin

You should now be in the directory with the binaries of ActivePerl. Type:

./ppm

This will start a nifty utility which will add modules to the ActivePerl port. Type:

install DBI

This should download and install the DBI module. Then type:

install DBD-mysql

This should download and install the DBD-mysql module. Finish with a simple q, and the ‘ppm’ program should quit.

This is it! We now have Perl installed with MySQL support!

Adding Perl support for MySQL on Mac OS X part 2

January 13th, 2006

I’ve been working on it, and it seems it is not as difficult as it was last year! We’ll start with the easy bits:

Download and install MySQL

This is fairly easy, go to the MySQL website, and follow the link ‘downloads’. Choose the ‘Generally Available (GA) release (recommended)’ version (at the moment this is MySQL 5.0), and follow that link. On the next page, scroll down untill you reach the section with ‘Mac OS X downloads’, and download the version that is suitable for your system and OS.

After the download is complete, doubleclick both packages and follow the instructions on the screen. You can also doubleclick ‘MySQL.prefpane’, which will install a small pane in your System Preferences, but this is less useful if you install ‘MySQL Administrator’; this pane can only stop and start the MySQL server, and force it to start when your Mac boots.

Download and install PHP

PHP you ask? Well yes, sometimes it can be handy to have PHP installed also, so we will do just that! Go to the official PHP website, again follow the link ‘downloads’. Under ‘Binaries for other systems’ (on the left), you will find Mac OS X. Follow that link, and search on this page for the heading ‘PHP 5 on Mac OS X 10.3/10.4′ (or later versions of Mac OS X when thay are available). Mac OS X Panther and Tiger come with Apache 1.3, so you need ‘PHP 5.0.4 for Apache 1.3′ (or higher if available); click on it and download the package. Again, mount the downloaded diskimage, doubleclick the package and follow the instructions on the screen. PHP is now available in Apache.

Download and install MySQL utilities

A handy utility that gives a lot of information about the MySQL server and databases is MySQL Administrator. On this page, follow the ‘Download Binaries & Source’ link (on the right side of the page), choose the version suitable for your system, and then choose the Mac OS X version.

Another utility that I found very convenient was CocoaMySQL, nice interface, and handy to inspect the contents of the databases, but it didn’t work quite as it should when I installed it under Tiger, but you can try it anyway.

Adding Perl support for MySQL on Mac OS X part 1

January 12th, 2006

Mac OS X comes standard with Perl, but, unfortunately, the modules necessary to access a MySQL database are not included in this Perl implementation. You have to add them yourself, and this is not a self-evident process. Why use Perl when there is PHP you may ask? PHP comes with MySQL support built in! Well, I’m very used to Perl, and don’t want to learn more PHP than is absolutely necessary. Although I must admit that this is not a very sensible attitude, commercial hosting companies usually don’t offer Perl support for MySQL either so I couldn’t use my knowledge on a real webserver. I will have to put my own webserver online somewhere!

DutchNature geregistreerd

December 23rd, 2005

Ik moet wel stapelgek zijn, maar ik heb vandaag het domein ‘dutchnature.com’ geregistreerd. Ik wilde toch een duidelijk domein voor mijn natuur video-podcasts, en dit domein bleek zomaar vrij; het was nog wel mijn eerste ingeving! Wat wel bestaat is ‘dutchnature.nl’, en helaas gaat die site niet helemaal over de natuur zoals ik die in gedachten heb; deze site is gewijd aan spoorzoeken met GPS op de Utrechtse heuvelrug. Never mind, ik heb toch toegeslagen. Ik zal proberen mijn site een klein portaltje te maken met links naar sites die te maken hebben met natuur in Nederland (en soms daarbuiten), in eerste instantie voor eigen gebruik. Ook zal ik hier een blog installeren waar ik mijn video-podcasts zal onderbrengen, nu maar hopen dat ik de energie kan vinden om ook wat op deze site te zetten!

Zondagsperikelen

December 11th, 2005

Vandaag heb ik Annemiek geholpen met het publiceren van haar derde podcast, en met het installeren van haar blog. We gebruiken allebei de PHP/MySQL blog software van WordPress, en die lijkt aardig te werken. Vrij eenvoudig te installeren ook, als je even doorhebt hoe je de MySQL database activeert bij je hosting-provider. De stappen die moeten worden doorlopen om een podcast te maken zijn:

1. Maak de podcast (bv. in GarageBand).
2. Exporteer naar iTunes.
3. Converteer het bestand naar MP3 in iTunes.
4. Upload het MP3 bestand naar je site.
5. Werk het XML bestand bij op je site.
6. Werk je Weblog bij met de aankondiging van je podcast, en geef links naar relevante sites.

My first Blog!

December 8th, 2005

Het moest er eens van komen, Maurice start zijn eigen Weblog! De vele gedachten moeten gewoon een uitweg vinden! Maar hoe lang ik het volhoud…