Community
OpenEnergyMonitor

OpenEnergyMonitor Community

Emoncms "The server requested authentication method unknown to the client"

Hey Guys.
Ive installed a AMP Stack on a FreeBSD Jail and cloned emoncms to it. Im currently hanging at this error message which i get when i head over to the emoncms page via browser.:

" Can’t connect to database, please verify credentials/configuration in settings.ini
Error message: The server requested authentication method unknown to the client"

So what i get from that is that apache is working, php is working, mysql login to the database is not working because the authentification method used by mysql is unsupported by emoncms.

apache version is: 2.4.48
php version is: 8.0.25
mysql version is: 7.4.20

Apparently the authentification in mysql 8 is initially set to some ssh or ssl method.

Using the following from within mysql

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

i changed it back to “the old way” by using the mysql username and password. but that still results in the same error.

i confirmed inside mysql that

mysql> SELECT CURRENT_USER() AS User, IF(plugin='','Native MySQL',plugin) AS Auth_Method
-> FROM mysql.user WHERE CURRENT_USER()=CONCAT(user,'@',host);
+----------------+--------------------+
| User | Auth_Method |
+----------------+--------------------+
| [email protected] | mysql_native_password |
+----------------+--------------------+

So if “mysql_native_password” is not the type emoncms exspects, what else is it? thanks a lot!

rebooting helped :slight_smile:

im now at.:

Fatal error : Uncaught Error: Call to undefined function session_get_cookie_params() in /usr/local/www/apache24/data/emoncms/Modules/user/user_model.php:148 Stack trace: #0 /usr/local/www/apache24/data/emoncms/index.php(145): User->emon_session_start() #1 {main} thrown in /usr/local/www/apache24/data/emoncms/Modules/user/user_model.php on line 148

some missing plugin to apache or php?

Ok i think i got it working under a FreeBSD jail for now. Steps i took.:

Create new FreeBSD Jail. Command line into jail.

$ pkg install -y sudo vim bash curl

$ adduser

# Username: USERNAME_YOU_LIKE
# Full name: FULLNAME_YOU_LIKE
# Uid (Leave empty for default): <Enter>
# Login group [younis]: <Enter>
# Login group is younis. Invite younis into other groups? []: wheel
# Login class [default]: <Enter>
# Shell (sh csh tcsh nologin) [sh]: bash
# Home directory [/home/younis]: <Enter>
# Home directory permissions (Leave empty for default): <Enter>
# Use password-based authentication? [yes]: <Enter>
# Use an empty password? (yes/no) [no]: <Enter>
# Use a random password? (yes/no) [no]: <Enter>
# Enter password: your_secure_password
# Enter password again: your_secure_password
# Lock out the account after creation? [no]: <Enter>
# OK? (yes/no): yes
# Add another user? (yes/no): no
# Goodbye!

$ visudo
# Uncomment next line by removing hash (#) sign
# %wheel ALL=(ALL) ALL

$ su - USERNAME_YOU_LIKE

$ sudo tzsetup

$ sudo pkg install -y apache24
$ sudo sysrc apache24_enable=yes
$ sudo service apache24 start

$ sudo pkg install -y mysql80-client mysql80-server
$ sudo sysrc mysql_enable=yes
$ sudo service mysql-server start
$ sudo mysql_secure_installation

$ sudo pkg install -y php74 php74-mysqli mod_php74 php74-filter php74-gettext php74-session
$ sudo cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini
$ sudo sysrc php_fpm_enable=yes
$ sudo service php-fpm start

$ sudo nano /usr/local/etc/apache24/modules.d/001_mod-php.conf

Then add the following entries to the file:

# <IfModule dir_module>
# DirectoryIndex index.php index.html
# <FilesMatch "\.php$">
# SetHandler application/x-httpd-php
# </FilesMatch>
# <FilesMatch "\.phps$">
# SetHandler application/x-httpd-php-source
# </FilesMatch>
# </IfModule>

$ sudo apachectl configtest
$ sudo apachectl restart

$ sudo nano /usr/local/www/apache24/data/info.php

Copy the line below and paste it into the configuration file:
# <?php phpinfo(); ?>

Head over to http://your_server_IP/info.php, and see if you read “It works!”
$ sudo rm /usr/local/www/apache24/data/info.php

Edit httpd.conf file for PHP
nano /usr/local/etc/apache24/httpd.conf
Search for AddType section – and add the following two lines

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

Search for DirectoryIndex line and change from:
DirectoryIndex index.html
to
DirectoryIndex index.php index.html
search for section starting with:
<Directory "/usr/local/www/apache22/data">
and scroll down to line:
AllowOverride None
and change to:
AllowOverride All
This is the Enable Mod Rewrite setting needed for Emoncms

sudo pkg install -y git
cd /usr/local/www/apache24/data
git clone https://github.com/emoncms/emoncms.git

mysql -u root -p
mysql> CREATE DATABASE emoncms;
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
mysql> exit

cd /usr/local/www/apache24/data/emoncms
cp default-settings.ini settings.ini
nano settings.ini

enter in mysql username and password from earlier under sql settings

reboot

browse to your_server_IP/emoncms

sources used:

h_____ttps://linuxhint.com/install-apache-php-mysql-on-freebsd/
h_____ttps://openenergymonitor.org/forum-archive/node/2272.html
h_____ttps://bobcares.com/blog/mysql-the-server-requested-authentication-method-unknown-to-the-client/
h_____ttps://www.techpaste.com/2013/01/determine-authentication-method-active-mysql-connection/

[Formatted for presentation - Moderator (RW)]

Ok php dependencies seem to work … computer is still saying “no”. it shows the webinterface now (see picture) but none of the elements are working apparently.:

Untitled-2

There is no further error messages and there is no content in /var/log/emoncms. How do i continue to debug now, what is not working?

i was triing to download the raspberry pi image to just take a look (i wont run anything that i require to be stable in such a nutshell), but thats running 1.4GB at 300kB/s so, yeah. i wont install debian in a VM because i dont want to dedicate ressources to a VM concept on my FreeBSD server. is there a possibility to get this done on FreeBSD or should i just skip this after messing with it for about 8h? apperently my post is not even going live until some admin clicks on it, which apparently noone did for the last 4h …

There’s no need for comments like that. The moderators here do this purely out of good will on a voluntary basis, and if nobody looks for a few hours - we do have lives to live. If you want to know, the system evaluated your post as spam, that’s why it failed to appear. One of us clearly read it, and decided otherwise.

And it would help if you formatted the quoted text - I’ve done that for you. When posting code or output, please put 3 ‘backticks’ (normally found at the top left of the keyboard) on a line of their own before the code, and 3 more backticks also on a line of their own after the code:

```
code
```

If it is something like php you can add a language identifier after the first 3 backticks: ```php or even ```text if you don’t want any language markup applied. You can also do that with a single line or in-line code, using two backticks, one before and one after the code. e.g. `AllowOverride None` will display as AllowOverride None.