0

I'll start by stating I'm not a server admin by trade, so I've been struggling with this task.

PHP 7.3.5 was already installed on RHEL7 running Apache. I have installed MySQL successfully and now I am tasked with connecting to the MySQL DB from PHP. I have done this before on hosted services like Bluehost, but they make it easy.

I am trying to install/enable the mysqlnd/mysqli modules to absolutely no avail. phpinfo() still does not show that it's enabled. I have tried to install packages and this is what I see when I locate:

enter image description here

How do I enable this module so it becomes active in PHP?

Updated with command from one of the answers below:

enter image description here

2 Answers2

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
  • Yes, MySQL is installed and running as expected as I installed it myself. It's the connection to PHP that's is causing me pain because I did not install PHP and going by other answers it's been done incorrectly. – Dan James Palmer Mar 29 '21 at 01:07
1

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.

tilleyc
  • 914
  • 4
  • 11