mysqli and coppermine not seeing eye to eye mysqli and coppermine not seeing eye to eye
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

mysqli and coppermine not seeing eye to eye

Started by Understudy, June 14, 2021, 06:14:43 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Understudy

So lets throw out the basics.
FBSD 12.2
MariaDB 10.5
PHP74
coppermine 1.6.10

coppermine and I have been arguing. I on the cli see the database from the user with the tables.
coppermine says mysqli hates me.
Could not create a MySQLi connection, please check the MySQLi details entered
Database error: No such file or directory

I offered it dinner and a movie. It said no.





ron4mac

Are you using 'localhost' as the dbserver?  (as you likely should)

Understudy


Understudy

So I have had no success. I just tried a fresh install and of coppermine and I am getting the same result.

The following errors were encountered and need to be corrected first:
Could not create a MySQLi connection, please check the MySQLi details entered
Database error: No such file or directory

When I use the command line from the server I have no problem logging in as the user and see the db and the tables.

Understudy

So apparently the issue is to not use localhost but 127.0.0.1

I am not a fan of this. It seems like a workaround.



ron4mac

Is this your own server?  That's a server setup issue. See how to configure the hosts file for localhost.

Understudy

So...this one took some work. Working with a tech from Manchester, England the fbsd forums, and a lot of google-fu we have a solution. Some notes here. I understand and respect coppermine's position on personal servers but I want to try and do and be better. And sometimes the result is what will become a bug report that may have a small impact on everyone who use mariadb/php/coppermine. Some explanation will be given here for those who want a better understanding, solution will end up at the bottom. Devs can view this as they will.

The basics are in the first post. What the hunt for the issue involved: Issues with mariadb 10.5 and the decision to eliminate mysql.user they changed it. The lack of info in the my.cnf file specific to server settings, even if they have the [client-server] setup. We ended up doing basic parameters under [server] just to be sure. The big one is the bind-address and skip-networking. The bind-address is needed but the skip-network needs to be commented out. This makes sure that you can do either of these:

mysql -h localhost -P 3306 -u username -p
mysql -h 127.0.01 -P 3306 -u brendhanhorne -p

You need to be able to do both of those enter your password and see it come to a mysql prompt. If either of those don't work you probably have an issue with your my.cnf file.

Once you have those now we get into the heavy stuff. The issue on a step 7 of the coppermine install is that it asks for a mysqli connection with a user name and pass and then would fail despite that it would work at the command line. I needed to make sure this was not a coppermine issue (it wasn't and I didn't think it was). So I did an install of myphpadmin. When I attempted to log in I would get a similar error. With myphpadmin's version and codes.

Here is where things got fun, we could do coppermine with 127.0.0.1 instead of localhost but that is not desirable. But the reason was with myphpadmin was you can't do that unless you alter their config.inc.php file. Which would work but that is not a solution. That is a work around and coppermine can't be deployed on servers all over the world only to work with a band-aid. So we had to do better. After eliminating everything else including apache24 we were left with php74. Out of the frying pan into the fire.

The understanding is getting php to translate to localhost. And for this we have a fix that we are not sure if it is a band-aid because it may be different for FBSD vs Linux vs Windows.


Solution:

edit the following file:
/usr/local/etc/php/ext-20-mysqli.ini

Add the following lines:
pdo_mysql.default_socket="/var/run/mysql/mysql.sock"
mysqli.default_socket="/var/run/mysql/mysql.sock"


Now to submit bug reports. We will start with PHP but I am not sure where this will end up if anywhere.


phill104

You should be able to edit your /etc/hosts file to add localhost.
It is a mistake to think you can solve any major problems just with potatoes.

Understudy

It had been there the whole time. Sorry for not clarifying that.


# $FreeBSD: releng/12.2/lib/libc/net/hosts 338729 2018-09-17 18:56:47Z brd $
#
# Host Database
#
# This file should contain the addresses and aliases for local hosts that
# share this file.  Replace 'my.domain' below with the domainname of your
# machine.
#
# In the presence of the domain name service or NIS, this file may
# not be consulted at all; see /etc/nsswitch.conf for the resolution order.
#
#
#::1                    localhost localhost.my.domain
127.0.0.1               localhost localhost.my.domain
#


ron4mac

In most implementations, I see something more like:


127.0.0.1         localhost
127.0.1.1         localhost.my.domain


And I've seen cases where it doesn't function correctly when configured as in your example.

Understudy

Cool, Thank you for the info. I have a fqdn and a static ip on the server I will add the line you have. Thank you.