Question

How To enable extension PDO In ubuntu 14.04

How to enable extension PDO in my ubuntu droplet


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

PHP should already have PDO extension enabled. What you probably need is the mysql driver for it.

# test if php5-mysql package is installed
dpkg-query --status php5-mysql | grep Status

# install the package if the above command indicates that it is not installed
sudo apt-get install php5-mysql

[Edit: oops, @ryanpq already answered]

You can do this with:

sudo apt-get update
sudo apt-get install pdo-mysql php5-mysql

If after this you are unable to use the extension you can check your /etc/php5/apache2/php.ini and make sure it includes:

extension=pdo.so
extension=pdo_mysql.so

This comment has been deleted