RHEL PHP 7.3.5 with mysqlnd and apache

Solution 1:

Did you check that you have everything yum installed? Are you sure its MySQL and not MariaDB which looks like MySQL?

You can check with

yum list installed | grep 'sql\|mariadb'

You can also ask PHP directly for modules with

php -m | grep sql

and then use

yum install mysql mysql-devel mysql-server php-mysqlnd

or

yum install mariadb mariadb-devel mariadb-server php-mysqlnd

That should be enough to get PHP making connections to the database, although you might need some additional packages based on your project.

Oh and a silly question, did you check sql is running?

systemctl status mysqld
systemctl status mariadb

Solution 2:

The php directory under home seems like a sure sign that PHP was manually installed somehow. See what the system shows installed via the package manager with sudo yum list installed | grep -i php.

On Redhat, I believe 5.4/5.6 are the default versions that come with the OS, with other versions (including 7) being made available via the Redhat Software Collections.

You can have multiple versions of PHP installed, and it appears that what has happened here is that there are multiple versions installed, and the mysqlnd/mysqli aren't being made available to the version that Apache is using.