CodeIgniter Forums

Full Version: getting error because of using php 7.2?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have moved my app from php 5.6 to php 7.2 because the dockerized version with xdebug was only avail in 7.2. Anyhow, I am getting this strange error. Is this due to the change from php 5.6 or due to some path error for the database or some problem with CI 3.11 and php 7.2? What should I look at first?


[docker://bitnami/php-fpm7:latest/]:php /opt/docker-substantiator/app/index.php

A PHP Error was encountered

Severity:    Warning
Message:    mysqli::real_connect(): (HY000/2002): Connection refused
Filename:    /opt/docker-substantiator/app/system/database/drivers/mysqli/mysqli_driver.php
Line Number: 201

Backtrace:
File: /opt/docker-substantiator/app/application/core/MY_Loader.php
Line: 277
Function: database

File: /opt/docker-substantiator/app/application/controllers/Users.php
Line: 15
Function: __construct

File: /opt/docker-substantiator/app/index.php
Line: 317
Function: require_once



Database error: A Database Error Occurred

Unable to connect to your database server using the provided settings.
Filename: controllers/Users.php
Line Number: 15


Process finished with exit code 8

Now if I go look at line 15  in Users.php I see:

function __construct() {
    parent::__construct();     << line 15
    $this->load->library('form_validation');
    $this->load->library('session');
    $this->load->model('User');
    $this->load->helper(array('form', 'url'));
    $this->load->database();
    $this->_init();

}
It's saying that your database settings are wrong.

If the php 7.2 you installed also installed MySQL then it must have changed
your MySQL password etc;
I can see that. But what is strange is that when I don't go through phpStorm and type localhost directly into the browser, it works fine. How can that be? Perhaps in that case it is using the mySQL that is not in the docker container?
Or phpStorm is not finding it through it's database config.

Check the phpStorm database settings.
I contacted the phpStorm support team. They stated that there is nowhere in phpStorm where I would set this. Here is the error I am getting:

Severity:    Warning
Message:    CI_DB_mysqli_driver::db_connect(): Property access is not allowed yet
Filename:    /opt/docker-substantiator/app/system/database/drivers/mysqli/mysqli_driver.php
Line Number: 201


Backtrace:
File: /opt/docker-substantiator/app/application/core/MY_Loader.php
Line: 277
Function: database

File: /opt/docker-substantiator/app/application/controllers/Users.php
Line: 15
Function: __construct

File: /opt/docker-substantiator/app/index.php
Line: 317
Function: require_once

I get about 7 or 8 of this same exact error, and the  finally I get to this line:
if ($this->_mysqli->real_connect($hostname, $this->username, $this->password, $this->database, $port, $socket, $client_flags))
which has this comment right below it:
// Prior to version 5.7.3, MySQL silently downgrades to an unencrypted connection if SSL setup fails

and this line fails with this error:

Database error: A Database Error Occurred



Unable to connect to your database server using the provided settings.

Filename: controllers/Users.php

Line Number: 15




Process finished with exit code 8