Topic: PDO not found in PHP80

Fedora 33 here.

I've installed the remi repos, following the wizard's instructions. Installed the language (php80-php) alongside a lot of packages, including of course, PDO (php80-php-pdo, php80-php-mysqlnd, etc...).

For some reason I can't make PDO work: the language can't find it:

[zaphod@magrathea bin]$ php -a
Interactive shell

php > $dbh = new PDO('foo', 'bar', 'baz');
PHP Warning:  Uncaught Error: Class "PDO" not found in php shell code:1
Stack trace:
#0 {main}
  thrown in php shell code on line 1

Same thing happens with trying it outside the interactive shell. The language simply doesn't find it.

It's present at /etc/opt/remi/php80/php.d/20-pdo.ini but it doesn't show in php -m...

Tried dnf reinstall on php80-php and php80-php-pdo, nothing works.

Please help.

Re: PDO not found in PHP80

try

rpm -qa php\* | sort
which php
php -v
php -m
module load php80
which php
php -v
php -m

On My Fedora 33 workstation

$ which php
/usr/bin/php

$ php -v
PHP 7.4.14RC1 (cli) (built: Dec 15 2020 16:06:57) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.14RC1, Copyright (c), by Zend Technologies

$ module load php80

$ which php
/opt/remi/php80/root/usr/bin/php

$ php -v
PHP 8.0.1RC1 (cli) (built: Dec 15 2020 12:57:35) ( NTS gcc x86_64 )
Copyright (c) The PHP Group
Zend Engine v4.0.1RC1, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.1RC1, Copyright (c), by Zend Technologies
Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: PDO not found in PHP80

Hi, Remi. Thank you so much for the quick reply.

This is a fresh install (I've actually waited for PHP8 to be released to install the language), so there's no previous php installation on this machine.

It's the same notebook from where I've tweeted this smile .

Re: PDO not found in PHP80

I think you are confused with php-pdo vs php80-php-pdo, as explained by https://blog.remirepo.net/pages/English-FAQ#scl

The reason why I ask for "rpm -qa php\* | sort"

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: PDO not found in PHP80

Argh! You're right! Solved by dnf install php-pdo

Thank you so much! big_smile

Re: PDO not found in PHP80

smile

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi