Error to Install LS 4.1.17 with MySQL 8 and InnoDB.

More
1 year 7 months ago #197502 by leandroOsBr
I had a problem when I went to install the Lime Survey 4.1.17 com MySQL version 8.0.9.
The enviroment I'm using is Digital Ocean With MySQL as the Platform. In this environment, MySQL MyISAM is disabled and, therefore, I can only use InnoDB.

First error:
Message...
"Please fix the following input errors:
You need to enable large_file_prefix setting in your database configuration in order to use InooDb engine for LimeSurvey!
Your database configuration needs to have innodb_file_format and innodb_file_format_max set to use the Barracuda format in order to use InooDb engine for LimeSurvey!"

however, as it is MySQL version 8, these environment variables no longer exist.


So that I could proceed, I edited the file: ".application/models/InstallerConfigForm.php":
Where was:
if ($this->isMysql && $this->dbengine === self::ENGINE_TYPE_INNODB) {
            if (!$this->isInnoDbLargeFilePrefixEnabled()) {
                $this->addError($attribute, gT('You need to enable large_file_prefix setting in your database configuration in order to use InnoDB engine for LimeSurvey!'));
            }
            if (!$this->isInnoDbBarracudaFileFormat()) {
                $this->addError($attribute, gT('Your database configuration needs to have innodb_file_format and innodb_file_format_max set to use the Barracuda format in order to use InnoDB engine for LimeSurvey!'));
            }
        }


I Changed to:
if ($this->isMysql && $this->dbengine === self::ENGINE_TYPE_INNODB) {
            #if (!$this->isInnoDbLargeFilePrefixEnabled()) {
            #    $this->addError($attribute, gT('You need to enable large_file_prefix setting in your database configuration in order to use InnoDB engine for LimeSurvey!'));
            #}
            #if (!$this->isInnoDbBarracudaFileFormat()) {
            #    $this->addError($attribute, gT('Your database configuration needs to have innodb_file_format and innodb_file_format_max set to use the Barracuda format in order to use InnoDB engine for LimeSurvey!'));
            #}
            $nothing = "Nothing";
        }


I just commented not to make these checks.


Fix this, the following error: Database Connection error!

I notice that "$this->dblocation", when the port is specified, It brought port information in the host parameter, getting "{host=host:port}".

To Fix it, I edited the file".application/models/InstallerConfigForm.php" and made the following corrections:
Where was:
private function getMysqlDsn() {
 
        $port = $this->getDbPort();
 
        // MySQL allow unix_socket for database location, then test if $sDatabaseLocation start with "/"
        if (substr($this->dblocation, 0, 1) == "/") {
            $sDSN = "mysql:unix_socket={$this->dblocation}";
        } else {
            $sDSN = "mysql:host={$this->dblocation};port={$port};";
        }
 
        if ($this->useDbName) {
            $sDSN .= "dbname={$this->dbname};";
        }
        return $sDSN;
    }

I changed to:
private function getMysqlDsn() {
 
        $port = $this->getDbPort();
        $host = $this->getHost();
 
        // MySQL allow unix_socket for database location, then test if $sDatabaseLocation start with "/"
        if (substr($this->dblocation, 0, 1) == "/") {
            $sDSN = "mysql:unix_socket={$this->dblocation}";
        } else {
            $sDSN = "mysql:host={$host};port={$port};";
        }
 
        if ($this->useDbName) {
            $sDSN .= "dbname={$this->dbname};";
        }
        return $sDSN;
    }

Creating the function:
/**
     * Get the host
     * @return string
     */
    public function getHost()
    {
        if (strpos($this->dblocation, ':') !== false) {
            $pieces = explode(':', $this->dblocation, 2);
            if (isset($pieces[1]) && is_numeric($pieces[1])) {
                return $pieces[0];
            }
        }
        return $this->dblocation;
    }

This way, I was able to proceed and complete the installation.

I believe that this code must be reviewed by the developers to correct this and other erros.

Then, share the workaround.

Regards.
The topic has been locked.
More
1 year 7 months ago #197506 by DenisChenu
There are something really great to check code update. It's git.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development . I don't answer to private message.
The following user(s) said Thank You: wpfan2099
The topic has been locked.
More
1 year 1 week ago #208510 by wpfan2099
dear LeandrOsBr. dear Denis,

i have issues in installing the limesurvey - in fact i allways get stuck in db connectoin


with the the newest version 4.xy
/umfrage/index.php?r=installer/database
Database creation
Database doesn't exist!
The database you specified does not exist:
LimeSurvey can attempt to create this database for you.


with the the LTS version 3.xy
/survey/index.php?r=installer/database
Database configuration
Please enter the database settings you want to use for LimeSurvey:
Please fix the following errors:
Try again! Connection with database failed.
Reason: SQLSTATE[HY000] [2002] No such file or directory


the issue allways - i cannot connect to the database:
it limesurvey dones not take the internal php driver to connect to the db then it ought to take the raw socket

#
/var/run/mysql/mysql.sock


there is no other option.

where to do the corrections - so that i get the connedtion ot the db-server!?

look forward to hear from you
reagards
The topic has been locked.
More
1 year 1 week ago #208540 by wpfan2099
well perhaps this is a solution:

i have issues in installing the limesurvey - in fact i allways get stuck in db connectoin


with the the newest version 4.xy
/umfrage/index.php?r=installer/database
Database creation
Database doesn't exist!
The database you specified does not exist:
LimeSurvey can attempt to create this database for you.


with the the LTS version 3.xy
/survey/index.php?r=installer/database
Database configuration
Please enter the database settings you want to use for LimeSurvey:
Please fix the following errors:
Try again! Connection with database failed.
Reason: SQLSTATE[HY000] [2002] No such file or directory


the issue allways - i cannot connect to the database:
it limesurvey dones not take the internal php driver to connect to the db then it ought to take the raw socket

#
/var/run/mysql/mysql.sock


there is no other option.
where to do the corrections - so that i get the connedtion ot the db-server!?

look forward to hear from you
reagards

PS; the issue allways - i cannot connect to the database:
it limesurvey dones not take the internal php driver to connect to the db then it ought to take the raw socket
/var/run/mysql/mysql.sock

there is no other option.


the question is: do we really need to have this as a the minimum set of requirements:
manual.limesurvey.org/Installation_-_Lim...rvey_on_your_website

Minimum 250 MB disk space.
MySQL 5.5.3 or later OR Microsoft SQL Server 2005 or later OR Postgres 9 or later.
Minimum PHP 7.0 or later; however, we recommend PHP 7.4 with the following modules/libraries enabled:
mbstring (Multibyte String Functions) extension library.
PDO database driver for MySQL (pdo_mysql or pdo_mysqli) or Postgres (pdo_pgsql) or MSSQL (pdo_sqlsrv for Windows and pdo_dblib for Linux).
Also, we assume in general that all PHP default libraries are enabled
hash
session
openssl or mcrypt
fileinfo
etc …


at least this thread seems to point this out:

CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002]

cf
forums.limesurvey.org/forum/installation...-sqlstate-hy000-2002


look forward to hear from you
The topic has been locked.
More
1 year 1 week ago #208541 by holch
Have you checked if the database driver for MySQL is installed on the server and up and running? Check your PHP info for pdo_mysql or pdo_mysqli.

To me it sounds that LS can not connect to your MySQL database and the missing driver might be a reason. Not an expert though.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The topic has been locked.
More
1 year 1 week ago #208550 by wpfan2099
hi there

checked the settings - see here

PDO
PDO support	enabled
PDO drivers	sqlite, mysql


pdo_mysql

PDO Driver for MySQL enabled
Client API version mysqlnd 7.4.11

The topic has been locked.

Start now!

Just create your account and start using Limesurvey today.

Register now