Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: mysqli and coppermine not seeing eye to eye  (Read 4973 times)

0 Members and 1 Guest are viewing this topic.

Understudy

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 51
    • Another boring website
mysqli and coppermine not seeing eye to eye
« on: June 14, 2021, 06:14:43 am »

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.




Logged

ron4mac

  • Administrator
  • Coppermine addict
  • *****
  • Country: us
  • Offline Offline
  • Posts: 2026
Re: mysqli and coppermine not seeing eye to eye
« Reply #1 on: June 14, 2021, 05:38:33 pm »

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

Understudy

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 51
    • Another boring website
Re: mysqli and coppermine not seeing eye to eye
« Reply #2 on: June 14, 2021, 11:41:36 pm »

I am :)

Logged

Understudy

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 51
    • Another boring website
Re: mysqli and coppermine not seeing eye to eye
« Reply #3 on: June 19, 2021, 05:55:24 am »

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.
Logged

Understudy

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 51
    • Another boring website
Re: mysqli and coppermine not seeing eye to eye
« Reply #4 on: June 19, 2021, 06:32:05 am »

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.


Logged

ron4mac

  • Administrator
  • Coppermine addict
  • *****
  • Country: us
  • Offline Offline
  • Posts: 2026
Re: mysqli and coppermine not seeing eye to eye
« Reply #5 on: June 19, 2021, 07:06:12 pm »

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

Understudy

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 51
    • Another boring website
Re: mysqli and coppermine not seeing eye to eye
« Reply #6 on: June 20, 2021, 11:39:57 pm »

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:

Code: [Select]
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:
Code: [Select]
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.

Logged

phill104

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4885
    • Windsurf.me
Re: mysqli and coppermine not seeing eye to eye
« Reply #7 on: June 21, 2021, 01:27:34 am »

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

Understudy

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 51
    • Another boring website
Re: mysqli and coppermine not seeing eye to eye
« Reply #8 on: June 21, 2021, 01:52:38 am »

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


Code: [Select]
# $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
#
Logged

ron4mac

  • Administrator
  • Coppermine addict
  • *****
  • Country: us
  • Offline Offline
  • Posts: 2026
Re: mysqli and coppermine not seeing eye to eye
« Reply #9 on: June 21, 2021, 05:01:46 am »

In most implementations, I see something more like:

Code: [Select]
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.
Logged

Understudy

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 51
    • Another boring website
Re: mysqli and coppermine not seeing eye to eye
« Reply #10 on: June 21, 2021, 05:13:20 am »

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. 
Logged
Pages: [1]   Go Up
 

Page created in 0.017 seconds with 20 queries.