Omke-s erreur (ssl): An exception occurred in driver: SQLSTATE[HY000] [1045] Access denied for user

Hello,
I am looking to disable SSL to connect to my hosting with Omeka-s 3.1.2 and I would like to know how I can integrate “MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT” in the code using Mysqli, the file is in “omeka-s\vendor\laminas-db\src\Adapter\Driver\Mysqli” to install the cms.
Php : 7.4.14
Mysql : 8.0.28
Omeka-s : 3.1.2
error: “An exception occurred in driver: SQLSTATE[HY000] [1045] Access denied for user”.
Ps: I can connect via a simple php script like this:

$conn = mysqli_init();
	$conn->options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, false);
	mysqli_ssl_set($conn, , , ,);

	$conn->real_connect('$hostname', $username, password,$dbname,$port,'MYSQLI_CLIENT_SSL');

Thanks for your help.
Linus_11

Translated with DeepL Translate: The world's most accurate translator (free version)

Can you just connect without SSL at all, instead of using it but disabling the certificate verification?

If you have to have it, then you can pass options to PDO using driverOptions in the database.ini file. The only wrinkle is that you can’t use the PDO:: constants you need in that file so you’d have to look up what they are actually. For example for me, setting PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT to 0 and PDO::MYSQL_ATTR_SSL_CA to the empty string looks like this at the end of config/database.ini:

driverOptions[1014] = 0
driverOptions[1009] = ''

Hello,

Sorry for the delay in my reply, I thought I had not been notified, your email went into spam.

I finally stayed on Omeka classic which works for me. Unfortunately Omeka-s didn’t work, though I would have liked to use it (more flexibility, features)

I don’t know in which folder in Omeka you can find the Init database, in the root of my FTP I only have a “config” folder, a db.ini file (If you know where to find the file/url to modify the PDO parameters you can tell me, thanks! - mybe at this url ? “omeka-s-3.1.2\omeka-s\vendor\laminas\laminas-db\src\Adapter\Driver\Mysqli” ? )

“db.ini” contains only this few lines :


user = ""

password = "".

dbname = ""

host = ""

;port =

;unix_socket =

;log_path =

For Omga classic I modify / added this lines at : “application/libraries/Zend/Db/Adapter/Mysqli.php”

add line 322

mysqli_ssl_set($this->_connection, NULL, NULL, NULL, 'null', NULL);

and replace.

  $_isConnected = @mysqli_real_connect(
            $this->_connection,
            $this->_config['host'],
            $this->_config['username'],
            $this->_config['password'],
            $this->_config['dbname'],
            $port,
            $socket
        );

with

$_isConnected = @mysqli_real_connect(
            $this->_connection,
            $this->_config['host'],
            $this->_config['username'],
            $this->_config['password'],
            $this->_config['dbname'],
            $port,
            $socket,
            MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT
        );

Thank lot for help !

You can’t use the mysqli connection options/functions in Omeka S, because it uses PDO instead.

Did you try the option I suggested above, of adding those “driverOptions” settings to the config/database.ini file? Even though they’re not listed by default, you can just add them at the end. You have to use those sort of opaque numbers, but you could use the PHP command line or write a simple script to look up what their values are for your system:

<?php
echo PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT . "\n" . PDO::MYSQL_ATTR_SSL_CA;

Hello,

Thank you for your message, sorry for the delay in my reply, I was unable to reinstall Omeka s until a few weeks ago for this project.

We decided that Omeka is not suitable for us (not enough plunging, lack of semantic web, etc).

I tried the solution you recommended,

<?php

driverOptions[1014] = 0
driverOptions[1009] = ''

?>

(I don’t know if you add <?php ... ?>
I still get an error here

When I echoed both variables.

echo PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT . "\n" . PDO::MYSQL_ATTR_SSL_CA;

I actually got two values back

PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT : 1014 
PDO::MYSQL_ATTR_SSL_CA : 1009

Version of Omeka: Omeka-s-3.2.3
Here is the error when I installed

Fatal error: Uncaught Error: Class 'Doctrine\DBAL\Platforms\MySqlPlatform' not found in /sites/mansaweb/www/web_main/application/src/Service/ConnectionFactory.php:37 Stack trace: #0 /sites/mansaweb/www/web_main/vendor/laminas/laminas-servicemanager/src/ServiceManager.php(765): Omeka\ServiceConnectionFactory->__invoke() #1 /sites/mansaweb/www/web_main/vendor/laminas/laminas-servicemanager/src/ServiceManager.php(201): Laminas\ServiceManager\ServiceManager->doCreate() #2 /sites/mansaweb/www/web_main/application/src/Service/ModuleManagerFactory.php(31): Laminas\ServiceManager\ServiceManager->get() #3 /sites/mansaweb/www/web_main/vendor/laminas/laminas-servicemanager/src/ServiceManager.php(765): Omeka\ServiceManagerFactory->__invoke() #4 /sites/mansaweb/www/web_main/vendor/laminas/laminas-servicemanager/src/ServiceManager.php(201): Laminas\ServiceManager\ServiceManager->doCreate() #5 /sites/mansaweb/www/web_main/application/src/Mvc/Application.php(32): Laminas\ServiceManager\ServiceManager->get() #6 /sites/mansaweb/www/web_main/index.php(20): Omeka\Mvc\Application::init() #7 {main} thrown in /sites/mansaweb/www/web_main/application/src/Service/ConnectionFactory.php on line 37

Thank you !
Linus

You don’t add the <?php or ?> in that .ini file. Just the two lines themselves. The two values you got back from the echo indicate that those driverOptions numbers are the correct ones for your installation, so that’s good.

As for the fatal error you’re getting, it indicates a missing file that should be part of the application… maybe you had some issue when you reinstalled it and you don’t have all the files in place?

Hello Jflatnes,

I tested your proposal this week and it works!
I have downgraded the version of Omeka S 3.1.1 because I think there are conf probes on the servers of our structure…
I still have some problems because when installing IIIF modules the system asks me to install Composer, I think I need to contact the support of the network systems structures.

Thank you again, your suggestions really helped me!

Linus.