Last night, I was setting up a development environment using Ubuntu 10.4 and a virtualbox virtual machine. And instead of getting to do some actual programming like I had intended, I was stuck chasing compilation errors because PDO didn’t appear to be working in PHP.
This never happens to you, right?
After five hours of hair pulling , frustrating work, I finally figured out what was going on. Since I found a lot of other references to people having this exact same issue, I figured I would post on what I did to make it work.
Why isn’t PDO Working?
So in the past, in order to install PDO, I would first install all the required libraries using apt-get (kinda like yum for all you redhat users out there). I would make sure that PEAR was installed, and from there, try and install PDO using PECL.
sudo pecl install pdo
But after running this command, some nasty “missing headers” errors appeared on my terminal. And after poking around for a bit on Google, it turns out that PDO has been moved to PHP5.3’s core so you no longer need to install it.
Further Problems
At this point I am thinking “Well, if pdo is already installed, then I just need to install pdo_mysql now…” so I ran the following command.
sudo pecl install pdo_mysql
But again I got another error stating “missing driver”, and I was really starting to wonder if I was going to have to compile everything from source. And like any good programmer on a deadline, this would have been lame because I couldn’t afford to waste any more of my precious time.
Current Solution
My last ditch effort was in using my good old friend tasksel to try and install absoluetly everything for me, so here is my solution in total.
- Install ubuntu 10.4 using virtualBox as my virtual machine
- Run updates to bring my system current
- Run sudo tasksel install lamp-server
- Run sudo a2enmod rewrite (to enable mod rewrite)
I then placed a phpinfo.php file into my /var/www directory and got the much needed output that I so strongly desired.
Final Thoughts
If there are any other Ubuntu nerds that happen to know what dependecy is actually failing and shed even more light on the subject, I would be all ears.
Again, I wouldn’t use the solution in a production environment because tasksel installs a lof of junk. But for getting a quick development environment up and running, it is currently is the fastest way to go. (Took me like 5 minutes once Ubuntu was installed)
Sources
In my quest for a solution, I happened upon a lot of references, so I am linking to all the sources I scoured.
- Ubuntu Forums 1
- Ubuntu Forums 2
- Theatons
- Ubuntu Forums 3
- Travis Berry <~~~ this last one is a great tutorial
Hopefully you won’t have any problems!
[…] This post was mentioned on Twitter by 8Bit, ChurchInfoTech. ChurchInfoTech said: PHP PDO Errors While Installing Ubuntu 10.4, PHP 5.3, and MySQL 5 http://bit.ly/caVgAX […]