How to install PDO on Ubuntu Edgy

Posted by Arkham on April 16th, 2007

Since PDO should be enabled by default on PHP >= 5.1 but it isn’t on X/K/ubuntu edgy, I had to go through some forums and tutorials to learn how.

Firstly, install php-pear and some other dev packages:

sudo apt-get install php-pear php5-dev libmysqlclient15-dev

Then use the pecl command to install pdo && pdo_mysql:

sudo pecl install pdo
sudo pecl install pdo_mysql

If you use a 64 bit system, an error message like

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to 
allocate 143 bytes) in /usr/share/php/PEAR/Builder.php on line 312

probably will come out, and editing the php.ini files to increase the memory_limit size won’t work.
Instead, edit the /usr/share/php/pearcmd.php file adding

@ini_set('memory_limit', '16M');

Add the drivers to your /etc/php5/apache2/php.ini

extension=pdo.so
extension=pdo_mysql.so

Restart your apache server:

sudo /etc/init.d/apache2 restart

Now you should be able to notice the pdo drivers installed in the phpinfo() page. Enjoy ;)

This entry was posted on Monday, April 16th, 2007 at 01:33 and is filed under computers. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Tags: , ,

Comments are closed.