0

The PDO documentation says:

PDO and the PDO_SQLITE driver is enabled by default as of PHP 5.1.0.

Now I've installed PHP 7.0.3 (apt-get install -y php7.0 php7.0-fpm php7.0-curl) on Ubuntu 14.04 and checked, whether PDO is installed -- on the CLI:

$ php -m | grep "pdo"
(empty output)

and in the browser:

enter image description here

There is no pdo.ini file and also nothing like pdo.so.

So, I would say, PDO is not installed.

How to get PDO for PHP 7 working (on Ubuntu 14.04)?


EDIT

I didn't want to install php7.0-mysql, since I thought, it would install the deprecated MySQL module. But it's not "just" depricated anymore -- it has been removed in the version 7.0, see docu:

This extension is deprecated as of PHP 5.5.0, and has been removed as of PHP 7.0.0.

So apt-get install php7.0-mysql actually installs the modules PDO_MYSQL and MySQLi.

Nevertheless I wonder, why the module PDO and is not displayed in the modules list. And where is its pdo.ini and its pdo.so file? And it's also strange, why the SQLite module is not installed, althpugh it actually should be, see docu: "This extension is deprecated as of PHP 5.5.0, and has been removed as of PHP 7.0.0.".

automatix
  • 14,018
  • 26
  • 105
  • 230
  • 1
    Have you had a look at `apt-cache search pdo`? – deceze Feb 16 '16 at 13:16
  • `apt-get install php7-mysql` – fusion3k Feb 16 '16 at 13:19
  • @fusion3k `E: Unable to locate package pdo-mysql` – automatix Feb 16 '16 at 13:21
  • 1
    @automatix there was a typo in my original comment (corrected 1 min ago). BTW search before, the exact command can be `apt-get install php7.0-mysql` or similar. Follow deceze suggestion and then run appropriate `install` command – fusion3k Feb 16 '16 at 13:23
  • @deceze Yes. But didn't found anything proper. What exaclty do you mean? – automatix Feb 16 '16 at 13:24
  • @automatix try to search for mysql instead of pdo. Is your apt pkg list updated? – fusion3k Feb 16 '16 at 13:25
  • In short: you need to install the right package. `apt-cache search ..` and `apt-cache show ..` are your friends here to figure out what that may be. Asking on SO to have it pointed out to you is of course an alternative... – deceze Feb 16 '16 at 13:25
  • According to [this tutorial](https://www.digitalocean.com/community/tutorials/how-to-upgrade-to-php-7-on-ubuntu-14-04): `sudo apt-get install php7.0-mysql` – fusion3k Feb 16 '16 at 13:27
  • @fusion3k Thank you very much -- this solved the problem. See the question update. – automatix Feb 16 '16 at 13:40
  • @Jay Blanchard PHP 7 is released and is not a RC anymore. So it's a bit another context. Would you please remove the "duplicate" flag from the question. Thanks. – automatix Feb 16 '16 at 14:01
  • 1
    Since the duplicate contains the same answer @automatix I don't see that the duplicate should be removed. Do you think having your question marked as a duplicate is a bad thing? – Jay Blanchard Feb 16 '16 at 14:06
  • 1
    @Jay Blanchard Usually it's actually not a good thing and every SO member should try to avoid this. Bt the reason, why I would to remove "duplicate" is, as described about -- that it (IMO) another question because of another context. Anyway, I can also understand your point. It's a gray area. – automatix Feb 16 '16 at 14:18

0 Answers0