Jump to content

Fedora 27/PHP/MySQL not playing together


digininja

Recommended Posts

I'm trying to help someone debug why they they can't get DVWA working on a Fedora 27 box so I built my own to test it out.

I've installed MySQL from the official MySQL repo (i.e. no using the default MariaDB) and got standard Apache and PHP installed. PHP is running as php-fpm.
 

[root@localhost php-fpm.d]# php-fpm  -m |grep mysql
mysqli
mysqlnd
pdo_mysql
[root@localhost php-fpm.d]# php -m |grep mysql
mysqli
mysqlnd
pdo_mysql

The mysqli modules are installed but when I try to use mysqli_connect I get an error saying the function doesn't exist. Checking phpinfo() and that agrees, there is no mention of the mysql extensions.

[root@localhost php-fpm.d]# cat /etc/php.d/30-mysqli.ini
; Enable mysqli extension module
extension=mysqli.so

[root@localhost php-fpm.d]# locate mysqli.so
/usr/lib64/php/modules/mysqli.so
/usr/lib64/php-zts/modules/mysqli.so

The mysql extension files are on the box and are referenced in the php config so I'm assuming that should enable them, I've not used fpm before.

The php-fpm ini file test says it is OK

[root@localhost php-fpm.d]# php-fpm -t
[28-Feb-2018 14:29:21.074218] NOTICE: pid 30341, fpm_conf_init_main(), line 1717: configuration file /etc/php-fpm.conf test is successful

But I still get this error in the log file:

[28-Feb-2018 14:30:42 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function mysqli_connect() in /var/www/html/dvwa/includes/dvwaPage.inc.php:467

Can any Fedora experts out there help? I'm assuming that I've not enabled the module correctly but not sure what I need to do to enable it.

And to preempt certain answers, this is a very specific config that I'm trying to debug, I don't need advice on getting this working using different distros or application stacks.

Link to comment
Share on other sites

Something I've just noticed, in the phpinfo() I have these entries:

Loaded Configuration File /etc/php.ini
Scan this dir for additional .ini files /etc/php.d
Additional .ini files parsed /etc/php.d/20-bz2.ini, /etc/php.d/20-calendar.ini, /etc/php.d/20-ctype.ini, /etc/php.d/20-curl.ini, /etc/php.d/20-exif.ini, /etc/php.d/20-fileinfo.ini, /etc/php.d/20-ftp.ini, /etc/php.d/20-gettext.ini, /etc/php.d/20-iconv.ini, /etc/php.d/20-json.ini, /etc/php.d/20-phar.ini, /etc/php.d/20-sockets.ini, /etc/php.d/20-tokenizer.ini

Yet my /etc/php.d directory has more files than that in it, including 30-mysqli.ini. I've tried copying that to 1-mysqli.ini just in case it was having problems with one of the 20's and so stopping loading the later ones but that hasn't helped.

 

 

 

Link to comment
Share on other sites

Turns out php runs as a service on Fedora so you have to restart it after making changes. After that I check the status of the service and get this error:

 

Feb 28 23:14:15 localhost.localdomain php-fpm[893]: [28-Feb-2018 23:14:15] NOTICE: PHP message: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mysqli.so' - /usr/lib64/php/modules/mysqli.so: undefined symbol: mysqlnd_global_stats 

which I think is caused because of a mix between the official MySQL release and the built in stuff that is expecting MariaDB. 

The solution I've seen suggested for this is to use the Remi repo rather than the official Fedora one but that hasn't helped.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...