« August 2006 | Main | October 2006 »

September 2006 Archives

September 3, 2006

How to Install DBD::mysql on Mac OSX Server 10.4.7 Universal

Okay after 3 days and very little sleep and trying all sorts of variations I finally got DBD::mysql to work.

For those that are interested I'll post how I figured this out at the end of this post but for now here are the steps I used:

Configuration: Mac Pro 2 x 2.66 Core2Duo/ OSX 10.4.7 Server Universal

NOTE: This may or may not work for those attempting to install on a different version of the server. For those who are attempting this with an older version of OSX please see my tip here.

1. install OSX Server 10.4.7 Universal Binary

(I always install everything as root. I don't want to hear anyone tell me i'm wrong for doing this. I do it this way.. you can do sudo if thats what you like!)

2. install X Code (at this writing its v. 2.4)

3. install MySQL 5x (I didn't want to use the one that Apple supplied since I wanted v.5)
*also note that you might need to have a database called test installed for this to work.

4. turn mysql on

5. open terminal and attempt to install DBD::mysql from CPAN. Type this:

sudo perl -MCPAN -e 'install Bundle::DBD::mysql'

NOTE: this install will fail but it will get you to the point you need to get to.

6. Let's fix the config now!

cd to your .cpan in the terminal:

cd ~/.cpan/build/DBD-mysql-[version]

sudo perl Makefile.PL \
--cflags="-I/usr/local/mysql/include" \
--libs="-L/usr/local/mysql/lib -lmysqlclient -lz -lm -lcrypt -lnsl"

make

make test

make install

7. Test to make sure that it works!

If you're interested in how I figured this out:

This morning I decided to try installing DBD::mysql on the non-server version of OSX that came with my MacPro just to see if it would work. I did the same procedure above, except: 1. It was standard MacOSX 10.4.7 not the Server version, 2. I only had to do up to step 5. Yep you read that right, DBD::mysql installed correctly the first time straight from CPAN!

Seeing that it installed without a hitch I decided to go ahead and see if the configs for DBD::mysql were any different and sure enough they were:

On the 10.4.7 SERVER this was the configuration that DBD::mysql would use:


cflags (mysql_config) = -I/usr/include/mysql -fno-omit-frame-pointer -arch ppc64 -arch x86_64 -pipe
embedded (mysql_config) =
libs (mysql_config) = -arch ppc64 -arch x86_64 -pipe -L/usr/lib/mysql -lmysqlclient -lz -lm
mysql_config (guessed ) = mysql_config
nocatchstderr (default ) = 0
nofoundrows (default ) = 0
ssl (guessed ) = 0
testdb (default ) = test
testhost (default ) =
testpassword (default ) =
testsocket (default ) =
testuser (default ) =

On 10.4.7 Standard edition this is what the config looked like:


cflags (User's choice) = -I/usr/local/mysql/include
embedded (mysql_config ) =
libs (User's choice) = -L/usr/local/mysql/lib -lmysqlclient -lz -lm -lcrypt -lnsl
mysql_config (guessed ) = mysql_config
nocatchstderr (default ) = 0
nofoundrows (default ) = 0
ssl (guessed ) = 0
testdb (default ) = test
testhost (default ) =
testpassword (default ) =
testsocket (default ) =
testuser (default ) =


So what I did was go back in and let CPAN install DBD::mysql, then go back and change its Makefile.PL settings to the the standard 10.4.7 settings. And now I've got movable type, mysql5, PHP5, apache2 all running nicely together on my Mac Pro. Thank God!

I'm no perl programmer or anything but something in MacOSX Server 10.4.7 universal is telling DBD::mysql to use those cflags and libs settings instead of the "correct" ones.

Hopefully this helps someone out there. It might not work on all installs but it worked for me and this version of the OSX Server.

UPDATE: Heres a followup report on this article.

September 5, 2006

How to Install DBD::mysql on Mac OSX Server 10.4.7 Universal part 2

NOTE: See previous entry about this here here

Interesting discovery which makes sense now:

I ran

mysql_config --cflags
and got:
-I/usr/include/mysql -fno-omit-frame-pointer -arch ppc64 -arch x86_64 -pipe

then ran:
mysql_config --libs
-arch ppc64 -arch x86_64 -pipe -L/usr/lib/mysql -lmysqlclient -lz -lm


Hmmm.... then I realized that mysql_config might be grabbing the wrong information since I'm NOT using Apples installed mysql version but rather a downloaded MySQL version 5 install.

When I changed to the correct install of mysql, the paths are now correct!

/usr/local/mysql/bin/mysql_config --cflags
-I/usr/local/mysql/include -Os -arch i386 -fno-common

/usr/local/mysql/bin/mysql_config --libs
-L/usr/local/mysql/lib -lmysqlclient -lz -lm

So I'm thinking the reason it installed fine with the standard non-Server version of OSX 10.4.7 is because there is no PREVIOUS install of MySQL on that version. The OSX Server version comes with mysql pre-installed but not running and it lives in /usr/bin/mysql. The download that I installed from mysql.com places it in /usr/local/mysql/ which is where it should be looking for --cflags and --libs but it isn't.

What to do?
I haven't tried this myself, but perhaps deleting the pre-installed version of mysql would help. I'm not sure where OSX keeps tabs of where all it's binaries are so I'm not sure how to update that part. If not you can always do it by hand in the previous post.

UPDATE: Read about how I updated DBD::MySQL to the latest version here.

September 6, 2006

Apple announces Updated iMac line, Upgrades MacMini

Today Apple finally updated their oh-so long in the tooth iMac line to Intel's new Core2Duo processors across the board and also add a 24" model to the lineup.
Update: Looks like the 24" version comes with Firewire 800!

Also upgraded today are the MacMini's with all of them receiving Core Duo chips across the lineup. The $599 model now includes a 1.66GHz Intel Core Duo processor. It used to have a 1.5 GHz Intel Core Solo processor. The $799 model now includes a 1.83 GHz Intel Core Duo processor. Great deals!

We've placed our order for the new 24" iMac and should have it in a week or so we hope!

September 26, 2006

Getting GD installed on OSX is a PAIN!

So theres this new Captcha plugin for Movable Type 3.3 but you need to install GD and a few other PERL modules (Authen::Captcha and GD) before you can use it. Should be an easy task but it's really not!

Before I started I did my usual "googling" for information on doing the install before I actually did it. I found a few things, but they seemed rather lengthy so I threw caution to the wind and went along my merry way attempting to install it all using CPAN. NO CAN DO. Things failed left and right when attempting to install.

I went back to google and found this helpful page:
Compiling GD on Mac OSX

Pretty good instructions and they are all step by step although, because I am on an Intel Mac Pro there were a few things I did differently.

For instance, to configure libpng, instead of following his advice to use the makefile.darwin script (which didn't work anyway) I chose to just run ./configure and let the Makefile figure things out on its own.

Also you'll want to do the following commands for installing GD after running ./configure:

rm ./libtool
ln -s `which glibtool` ./libtool.

then do make and make install.

Figuring it all out so that it compiled nicely took the longest! After GD was installed, installing the perl modules was pretty simple. Thank God there was documentation out there for doing this install. If not I'd have given up (and I actually was about to give up because of the constant error messages).

Sadly I couldn't get Captcha to work because the plugin stored the images in the CGI directory. The author of the plugin claims he's working on a fix though!

About September 2006

This page contains all entries posted to MacNewsBlog in September 2006. They are listed from oldest to newest.

August 2006 is the previous archive.

October 2006 is the next archive.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 4.1