I've been working for the last two nights to set up my own LEMP server on Amazon ec2. I'm not a server expert so it's been slow going, and the latest error "could not find driver" is given when attempting to create the new PDO object.
I've read what seems like dozens of threads about this error, and unfortunately none of the fixes seem to work for me. For the most part they all say I have to install php-mysql - but of course that's not available:
$ sudo yum install php-mysql
Last metadata expiration check: 0:22:54 ago on Sat 17 Aug 2019 02:26:41 AM UTC.
No match for argument: php-mysql
Error: Unable to find a match
Meanwhile, phpinfo() seems to report that a driver is installed??
MySQL driver for PDO George Schlossnagle, Wez Furlong, Ilia Alshanetsky, Johannes Schlueter
But under the PDO section of phpinfo() it says:
PDO drivers odbc, sqlite
So I suppose the mysql driver really is missing? Leaving me at the same spot - finding it and installing it... But how to find the right one for my setup? I tried using yum to search but that failed (big surprise):
$ yum search php-
Red Hat Update Infrastructure 3 Client Configuration Server 8 0.0 B/s | 0 B 00:00
Error: Failed to synchronize cache for repo 'rhui-client-config-server-8'
Googling that error got me lost in another hundred or so threads, none of which helped..
Can anyone point me in the right direction? I imagine there's a simple command I need to run that's particular to my setup, I just need to figure out what it is..
Some other things I've tried:
- run a php script from the linux command prompt to verify that the problem
exists there: it does
- check php.ini settings (they seem good, I'll paste them below)
- check /etc/php-fpm.d/www.conf settings (these also seem good, will paste below)
Here's my various OS details:
$ cat /etc/os-release
NAME="Red Hat Enterprise Linux"
PRETTY_NAME="Red Hat Enterprise Linux 8.0 (Ootpa)"
REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
$ php -v
PHP 7.2.11 (cli) (built: Oct 9 2018 15:09:36) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
$ nginx -v
nginx version: nginx/1.14.1
$ mysql --version
mysql Ver 8.0.17 for Linux on x86_64 (Source distribution)
and some excerpts from php.ini:
; Whether to pool ODBC connections. Can be one of "strict", "relaxed" or "off"
; If mysqlnd is used: Number of cache slots for the internal result set cache
pdo_mysql.cache_size = 2000
; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
excerpts from /etc/php-fpm.d/www.conf:
user = nginx
group = nginx
Hope that's enough info - thank you in advance for any help!