I need to enable pdo-mysql in digital ocean ubuntu 16.04 server on my php 7.1

I found that my project uses php7.1 from phpinfo(). And from other forums, I found that uncommenting from /etc/php/php7.1/apache2/php.ini and restarting the server solves the issue. But in my php.ini, there is only php_pdo_mysql.dll. Since it is a linux server, I know dll files don’t work. How do i install pdo?

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.


If you’re running apache2, you can try to install the missing PHP module using the following command:

sudo apt-get install php7.1-mysql

If the system is unable to locate this package then it’s simply not available in the repositories that you have configured on the server.

If this is the case you can enable the Ondrej PHP repository by typing:

sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php

Then you can try to install PDO again:

sudo apt install php7.1-pdo

If you’re still having issues, then my suggestion will be to check this article on DigitalOcean’s website and check the PHP part of it. Everything is explained really well and you should be able to sort this out:

Let me know how it goes.