Can you help a little bit more ?

A fatal error has occurred
DB Error: extension not found
Details have been logged for the administrator.
Don't panic.
I think php5 has left a directory behind and one of the templates is still thinking that php5 is installed and trying to load modules from the wrong place.
Have a look in /usr/lib
Do you see a php AND php4 directory ? If you do then php4 probably have the modules you want and php is empty.
If they both exist, delete the php one.
rm -dr /usr/lib/php
Then
expand-template /etc/php.ini
signal-event post-upgrade
signal-event reboot