Archive for March 16th, 2011

How to fix php “Uncaught exception ‘PDOException’ with message ‘could not find driver'” on FreeBSD

Wednesday, March 16th, 2011

After some upgrades of PHP, My Less’n More URL suddenly stopped working with an error:

Uncaught exception 'PDOException' with message 'could not find driver'

After a bit of investigation I’ve figured out the error is caused by a missing php5-pdo and php5-pdo_mysql

Of course if you’re using php52 you will need to install respectively the ports php52-pdo and php5-pdo_mysql :

To resolve the issues issue the commands:

freebsd# cd /usr/ports/databases/php5-pdo
freebsd# make install clean
freebsd# cd /usr/ports/databases/php5-pdo_mysql
freebsd# make install clean

How to fix configure: error: gd library not found.. please install libgd during webalizer port make on FreeBSD

Wednesday, March 16th, 2011

I’ve done a couple of updates these days on my tiny FreeBSD server system. I’ve updated Apache and PHP to version:

pcfreak# pkg_info |grep -i php5-5; pkg_info |grep -i apache-2.0.64
php5-5.3.5 PHP Scripting Language
apache-2.0.64 Version 2.0.x of Apache web server with prefork MPM.

As a requirement for the php5-5.3.5 update it was necessary that I update a number of modules the whole list of php modules which I’ve updated can be seen in my previous blog post named core dump after PHP5 and php5-extensions recompile (rebuild) from ports on FreeBSD – cause and solution

Some further updates I’ve done manually on the BSD in order to be able to properly compile my support libgd in Apache and PHP were in the system ports:

pcfreak# pkg_info |grep -i gd-
gd-2.0.35_7,1 A graphics library for fast creation of images
php5-gd-5.3.5 The gd shared extension for php

One night after all the updates I’ve realized my installed version of webalizer was not showing / generating properly the images of the webalizer daily generated statistics via cron.

Logically to fix that it was necessary that the /usr/ports/www/webalizer port to be rebuilt through make install clean

I’ve jumped on and executed the well known:

freebsd# cd /usr/ports/www/webalizer;
freebsd# make install clean
The download compile of the webalizer started as expected but just in a couple of seconds it failed with:

ecking for main in -lgd… noconfigure: error: gd library not found.. please install libgd

What was strange was that the gd-2.0.35_7,1 port was properly installed and therefore I could see no reason for the webalizer build failure.
I’ve spend about an two hours to look online in forums about somebody who got the same error with no luck.
As I couldn’t find anything that could help me up online, I’ve decided to drop by the good old irc.freenod.net ##freebsd channel to ask for help.

Luckily enough the guy with a nickname Mystique has suggested a solution of using the freebsdportmaster in order to solve the gdlib issues.

He suggested something might be broken with my gd-2.0.35_7,1 – gdlib install and adviced me to rebuild the gdlib port with:

freebsd# cd /usr/ports/graphics/gd
freebsd# portmaster .

Anyways what I did was a bit different I used his postmaster . suggestion but applyed it directly for the webalizer port with:

freebsd# cd /usr/ports/www/webalizer
freebsd# portmaster .

All worked like a charm and just about few minutes later my webalizer was compiled fine and working with the gdlib support, e.g. showing me the webalizer statistical data pictures 😉